Postfix email forwarding

From vpsget wiki
Jump to: navigation, search

Let's assume that we have a mail server vpsget.com and we want to redirect all emails sent to user@vpsget.com elsewhere, for example to user@gmail.com

Open conf file of Postfix:

nano /etc/postfix/main.cf

Append/edit the following lines:

virtual_alias_domains = vpsget.com 
virtual_alias_maps = hash:/etc/postfix/virtual

Open aliases file:

nano /etc/postfix/virtual

Append the following line

user@vpsget.com user@gmail.com

We also can forward all mailboxes hosted at vpsget.com to user@gmail.com:

@vpsget.com user@gmail.com

Save changes and restart Postfix:

postmap /etc/postfix/virtual
service postfix restart