I need to get Postfix to inspect the MAIL FROM of the envelope and determine whether it matches the authenticated user of the session.

If it does not, it should then add or update the "Sender: " header inside the e-mail so that its value is that of the authenticated user.

I understand that this can be done using sender_canonical_maps but, having tried a few remedial tests, I'm unable to get it working. More than anything I would like to know whether this is actually possible with Postfix, and secondly whether I am in the right ball park. Lastly, an example of how to do it would be fantastic.

Thanks very much.


I was sorry to find no answers here yet, but I was glad to find your reference to sender_canonical_maps. After changing my ISP from Comcast to AT&T (U-verse) I had the same need to change sender addresses. My new AT&T ISP seems to only accept emails with a sender address set to my new att.net address. I don't use that email addresses, but I just want to email various computer generated local emails to my gmail account. I'm not sure why it didn't work for you, but I successfully used sender_canonical_maps to do just that. In main.cf I put:

local_header_rewrite_clients = permit_mynetworks
remote_header_rewrite_domain = att.net
sender_canonical_maps = hash:/etc/postfix/sender_canonical_maps

In sender_canonical_maps I put:

root             myattusername@att.net
me               myattusername@att.net
me@mydomain.net  myattusername@att.net

Did postmap hash:/etc/postfix/sender_canonical_maps and restarted postfix. It might be possible to do this in a simpler/easier way, but this worked for me. Getting postfix to use smtps on port 465 to AT&T's mail server was another issue, but I managed that as well.

Your Answer

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

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