Setup Virtual Domain Postfix

Scenario:
– Forward certain email recipient to another email address.
– Forward local Unix account email address to another email recipient because in the Postfix server don’t have mailbox.

System:
Postfix on CentOS 7/RHEL 7 (also work on CentOS 6/RHEL 6)

Steps:
– Edit main.cf
# vi /etc/postfix/main.cf
Edit the below parameter.

virtual_alias_domains = example1.com,example2.com
virtual_alias_maps = hash:/etc/postfix/virtual

– Edit /etc/postfix/virtual
# vi /etc/postfix/virtual
Add the destination email domain that will forward to:

# Recipient --> forward address
root@example1.com abcd@sample.com
postmaster@example1.com abcd@sample.com
lelah@example2.com abcd@sample.com

– Run postmap everytime any update in the virtual file
# postmap /etc/postfix/virtual

– Reload Postfix configuration (no need to restart service)
CentOS 7: # systemctl reload postfix
CentOS 6: # service postfix reload

References:
http://www.postfix.org/VIRTUAL_README.html
http://www.postfix.org/ADDRESS_REWRITING_README.html
http://www.berkes.ca/guides/postfix_virtual.html


Leave a Reply

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