On 1/28/2011 3:43 PM, Jerrale G wrote:
On 1/28/2011 2:55 PM, Noel Jones wrote:
On 1/28/2011 12:24 PM, Jerrale G wrote:
This is fine as long as I know how to keep the other part of
the line in a variable, like $1 or $3 and know how to put it
all back together afterwards. Could someone help me with this,
please?

An example replacement given the header
X-MyHeader: this is it

# /etc/postfix/header_checks
/^(X-MyHeader: .*) is (.*)$/
  REPLACE $1 was $2

end result:
X-MyHeader: this was it


While the concept is simple, it can be hard to get right[1], so one must consider if it's worth doing.

So, what are the headers you are trying to transform? Why do they say localhost and why do you think they shouldn't? Maybe removing the offending header with an IGNORE rule would be better?



Is there anything, for the headers, that is like sed?

Not that I'm aware of.  Some milter might exist with such a feature.


[1] You need to be careful to only match the intended header, only replace the intended text, and never mangle headers supplied by other systems. There are resources for writing regular expressions on the web that will generally apply to postfix.



  -- Noel Jones

Thank you, again, Noel. Wietse and You are an asset to postfix developing!

This should be corrrect, too, right?

/(^X-Spam-Status:\sYes,\sscore=\d\d(\.\d)?\s)/i
        DISCARD High Potential for Spam




Jerrale G.
SC Senior Admin

sorry for not including. Centos automatically puts 127.0.0.1 as $hostname in /etc/hosts.



Jerrale G.
SC Senior Admin

Reply via email to