Postfix: Rewrite sender on outgoing mails

With Postfix you can rewrite the sender, respectively the from-headers for outgoing mails. Prerequesite is an existing Postfix installation.

Create the /etc/postfix/sender_canonical, with the following example content (you may use spaces or tabs to separate the columns):


Next create the sender_canonical.db file:

postmap hash:/etc/postfix/sender_canonical

Add sender_canonical variable to /etc/postfix/

postconf -e "sender_canonical_maps=hash:/etc/postfix/sender_canonical"

Restart Postfix:

/etc/init.d/postfix restart

And that's it. For example outgoing mail from your webserver (www-data) will be sent out from