Install Postfix MTA
We are assuming that you already have postfix installed and configured on your system. Or you can use following commands to install Postfix on Linux box according to your operating system.On Debian Based Systems
$ sudo apt-get update $ sudo apt-get install postfix
On RHEL Based Systems
# yum install postfix
On OpenSUSE Systems
# zypper in postfixAfter installation make sure Postfix is running on your system. Default postfix used standard port 25. Use the following commands to check that your system is listening on port 25 or not.
# netstat -tulpn | grep 25 tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 4398/master tcp6 0 0 :::25 :::* LISTEN 4398/master
Configure Email Forwarding in Postfix
Let’s start with email forwarding configuration in Postfix configuration file (/etc/postfix/main.cf). Edit this file and add/edit the following configurations. Change example.com and example.net domain names with your domain namevirtual_alias_domains = example.com example.net virtual_alias_maps = hash:/etc/postfix/virtualAfter making any changes in configuration files make sure to restart Postfix service.
Email Forwarding Examples
/etc/postfix/virtual is the file where we will add email forwarding rules. Let’s starts begin with the email forwarding rules.1 – Forward all emails sent to info@example.com and info@example.net to rahul@myemail.com.
info@example.com rahul@myemail.com info@example.net rahul@myemail.com2 – Forward support@example.com emails to rahul@myemail.com and admin@myemail.com
support@example.com rahul@myemail.com admin@myemail.com3 – Forward any email sent to @example.com domain to rahul@myemail.com. Also forward any email sent to @example.net domain to rahul@myemail.com as well as admin@myemail.com
@example.com rahul@myemail.com @example.net rahul@myemail.com admin@myemail.com
Comments
Post a Comment