Postfix email forward
On an Ubuntu Server, i done following to setup email forwarding.
Install postfix
apt -y install postfix
Edit /etc/postfix/main.cf, add following
vi /etc/postfix/main.cf
Add
virtual_mailbox_domains = YOUR-DOMAIN_HERE.com virtual_mailbox_base = /var/mail/vhosts virtual_mailbox_maps = hash:/etc/postfix/vmailbox virtual_minimum_uid = 100 virtual_uid_maps = static:5000 virtual_gid_maps = static:5000 virtual_alias_maps = hash:/etc/postfix/virtual
Create Virtual mailbox
vi /etc/postfix/vmailbox
Add
user1@YOUR-DOMAIN_HERE.com YOUR-DOMAIN_HERE.com/user1
Create alias file, used for mail forwarding
vi /etc/postfix/virtual
Add
admin@YOUR-DOMAIN_HERE.com [email protected]
Wth above configuration, mail coming to admin@YOUR-DOMAIN_HERE.com will get forwarded to [email protected]. Email coming to user1@YOUR-DOMAIN_HERE.com get delivered to local mailbox folder.
Now run following commands to make hashmap
postmap /etc/postfix/vmailbox postmap /etc/postfix/virtual
Restart postfix
systemctl restart postfix