Changing the sender address in Postfix

when you have set up postfix to relay all mails via an external smtp server, you might not want to have your servers internal users and fqdn composing the sender address of your outgoing mails. often spam filters try to verify the sender address and internal usernams and domains might not validate from the internet. so it is helpful to masquerade your systems email addresses with a valid email address from your internet provider in order to make sure that a) your email won't be caught in a spam filter and b) replies come back to a valid address which you actually read :)

luckily postfix provides smtp_generic_maps that do just that: edit /etc/postfix/ and add this line:

smtp_generic_maps = hash:/etc/postfix/generic

save and close and now open /etc/postfix/generic now to change the from header for root@myhost.mydomain.local to enter a line like this to that file:


once again, save and close now create the table using postmap:

postmap /etc/postfix/generic

and finally, restart postfix

/etc/init.d/postfix restart
  • changing_sender_address_in_postfix.txt
  • Last modified: 05.05.2015 18:03
  • by Pascal Suter