Postfix rewrite sender email address [Linux|Unix]

Postfix Main server

If sender ‘’ sends an email, his email address should change to ‘’ and at the receiver’s mailbox, the from address must be shown as ‘’. This article provides a step by step procedure rewriting sender email address using Postfix.


  • If sender ‘A’ sends an email to any recipient/email address, sender address of ‘A’ should change to ‘B’ before postfix sends the email to the recipient.
  • Postfix Rewrite sender email address
  • Postfix modify sender email address
  • Postfix change sender email address


  • Linux


We can use postfix ADDRESS_REWRITING feature to achieve this goal. Refer to the following upstream documentation for more information.

Postfix Rewrite Sender Email Address Configuration
  • Add the following entry in /etc/postfix/ file.
sender_canonical_maps = hash:/etc/postfix/canonical_sender_address

  • Add all your requirement to /etc/postfix/canonical_sender_address file. And the following is the sample entry.
$ cat /etc/postfix/canonical_sender admin

  • The above example, rewrites sender address to

  • Then execute the following command to build the HASH database for postfix.

# postmap hash:/etc/postfix/canonical_sender

  • Now restart postfix service to validate the configuration.

You May Also Like


About the Author: TekFik

TekFik is a technical blogging site helps techies and engineers to solve their day to day issues and also allows everyone to share knowledge and feedback. Please feel free to contact us at if there is anything.

Leave a Reply

Your email address will not be published. Required fields are marked *