regexpostfix-mtaemail-headers

Broken syntax in Postfix header_checks


I`m setting up Postfix to edit the headers dependent on the reciever. This is done through header_checks(http://www.postfix.org/header_checks.5.html)

The logic is as follows: If the e-mail is sent to "erik@sorgaard.net" then we copy the From field and an paste it to the Reply-To field, the From field is also set to "erik@sorgaard.net".

I have no experience with regexp but through some searching I was able to come up with the following:

if /^To: (erik@sorgaard.net)\s.*$/
/^From: (.+@.+)\s.*$/ PREPEND Reply-To:$1
/^From: (.+@.+)\s.*$/ REPLACE From: erik@sorgaard.net
endif

This does not work. I'm not sure what's wrong with the syntax, but any help would be very appreciated.

Regards Erik


Solution

  • The problem is that the header_checks are applied only one time for each email line, so the seconf "From" line (line 3) is skipped.