I've configured Postfix to use SMTP through another relay host. Now I need to change the email headers in order to be accepted by the relay host because the application which runs on my server is an obsolete management software that puts the user's email address into the FROM header (this is dumb and a reason to get rejected) - since I don't have the time to change the code, I want to force Postfix to alter the headers. What I'm trying to achieve:

  1. The current FROM header should be moved into the REPLY-TO header
  2. The FROM header should be set per default using the same email address for every outgoing message

Regarding the second point - I've figured out how to do it, simply by putting the following contents into /etc/postfix/sender_canonical_maps and /etc/postfix/header_check (and by updating main.cf of course):

# /etc/postfix/sender_canonical_maps
/.+/    newsender@address.com
# /etc/postfix/header_check
/From:.*/ REPLACE From: newsender@address.com

But the first point is causing me problems - how can this be done with Postfix? How can I put the current FROM header into the REPLY-TO header?

  • Try to be more specific about which field is set to what (is it only the header that is wrong, or also the envelope sender?). If you REPLACE a header, then postfix will still fixup missing headers afterwards, so just replacing the From: with Reply-To: might be sufficient. – anx May 11 at 11:56
  • @anx the current data that is put by the application in FROM should move to REPLY-TO and how I set the FROM (which automatically sets the envelope-from as well) has been done already :) Do you know how I could replace the From: with Reply-To:? – manifestor May 11 at 12:08
  • Put another way: Why is /From:(.*)/ REPLACE Reply-To:$1 not your solution? – anx May 11 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.