Setup Mail Gateway/Forwarding using Postfix

I will show you on how to setup a mail forwarding run in Postfix, which is my MX record will be the email gateway and this server will forward all emails to my mail server which run under cPanel.

What we really need is an MTA (mail transfer agent), application which route your email here and there until all the transaction complete and the email reach the destination. Variables as below:

OS: CentOS 5.5 64bit
MTA version: Postfix 2.3.3
Mail gateway IP: 28.90.150.2
Mail gateway IP: forwarder.getmail.com
Destination server (cPanel): 28.90.166.73
Domain: getmail.com, yoursetup.net and mymouse.biz

1. In this case, I already have MX record which pointing to my cPanel server for 3 domains as below:

getmail.com.    MX    10    mail.getmail.com.
mail             A          28.90.166.173
 
yoursetup.net.    MX    10    mail.yoursetup.net.
mail               A          28.90.166.173
 
mymouse.biz.    MX    10    mail.mymouse.biz.
mail             A          28.90.166.173

2. Lets setup and configure MTA and all required applications. We also need to stop sendmail (by default has been enabled by system), remove sendmail from start-up service, disable SElinux and install Postfix using yum:

service sendmail stop
chkconfig sendmail off
setenforce 0
yum install postfix -y

3. We need to do some configuration to tell Postfix what type of MTA it should be. Edit /etc/postfix/main.cf with text editor and change or uncomment following value: Continue reading “Setup Mail Gateway/Forwarding using Postfix” »