13

I am using Postfix as a gateway for my domain and need it to change or rewrite the Envelope From address to match the From header. For example, the From: header is "joe@domainA.org" and the Envelope From is "bob@domainB.com". I want Postfix to make the Envelope From "joe@domainA.org" before relaying it on. I took a look at the Postfix Address Rewriting document but couldn't find anything that matched my use case.

(In case you're curious why I need to do this: Gmail uses the same Envelope From when sending from a particular account, no matter which From: address you choose to use. I would prefer not to disclose the account being used to send the email. Also, it messes with SPF/DMARC domain alignment - see 4.2.2 of the DMARC draft spec.)

5
  • It would be helpful if you could give some examples. So what the headers currently look like and what you're trying to get them to look like.
    – webtoe
    Mar 13, 2012 at 14:51
  • 1
    did you ever find a working solution for your problem? I have the same question and for much the same reasons...
    – gogoud
    May 10, 2016 at 14:45
  • I've been wrestling with this for hours tonight, winding up in all kinds of corners of the Internet, trying to figure out how to do this. Literally all I want to do is make Postfix take the From address, whatever it is, and pass it along during sending such that the Return-Path is the same. It seems to be utterly impossible, though I would love to be proved wrong.
    – dgw
    May 28, 2016 at 7:57
  • 2
    wow, 5 years ago, no real answer, and I'm in the same boat now :( May 20, 2017 at 19:25
  • 1
    How about 9 years later :-(
    – koma
    Aug 26, 2021 at 11:23

1 Answer 1

0

I believe you want "sender_canonical_maps" (and "recipient_canonical_maps" if you want inbound mail to be translated backwards):

http://www.postfix.org/postconf.5.html#sender_canonical_maps

3
  • As far as I can tell, this only implements a table lookup. However, there might be several different From header addresses used with the same Envelope From address, so the table needs to act somewhat dynamically. Is there a variable for the From header address that can be used for the result?
    – lid
    Mar 23, 2012 at 9:38
  • You could specify a regular expression: postfix.org/DATABASE_README.html#types Nov 29, 2013 at 12:24
  • 2
    I don't see a way to do the rewriting dynamically, specifically to rewrite the envelope address based on the 'From:' address - even using regex or pcre tables...
    – gogoud
    May 10, 2016 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.