Forward mail with postfix

Unconditionally forward (move on) all mail, coming into a mail server for a particular user, to an external e-mail account (e.g. Google Gmail account). The user may be non-existent at the particular server system. Postfix is assumed to be installed and running well.

Open in text editor the file /etc/postfix/ and add two new lines:
virtual_alias_domains =
virtual_alias_maps = hash:/etc/postfix/virtual

Substitute with your actual domain name for the accounts (actual or virtual) which will have their mail forwarded.

Then make a list of the users (actual or virtual) at this domain who will have their mail forwarded and write their new e-mail destinations. For this you create a new file /etc/postfix/virtual and open it for editing.

In this file you make a very simple list consisting of records like this:

This will make all incoming mail addressed to to proceed directly to instead. Besides, it does not really matter if the user john does actually have an account at the particular computer of

The final step. Run these two commands for the mail system to process the list you just created and to restart itself:

postmap /etc/postfix/virtual
/etc/init.d/postfix reload

Though, at least in particular to Gmail, you may want to reconsider if you actually want to forward mail to their server. Why? You may be taken for a spammer and blacklisted. Read more here.


One Comment on “Forward mail with postfix”

  1. mulberry コレクション

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s