First of all we install postfix package (if not already installed):

yum install postfix

It’s always a good idea to have a backup:

cp -rvp /etc/postfix/  /etc/postfix.DEFAULT

Now let’s edit main config file /etc/postfix/main.cf with your details:

myhostname = given.hostname
mynetworks = 10.0.0.0/16, 192.168.1.0/24, 127.0.0.0/8 (your networks)

Now set the outgoing credentials in this new file /etc/postfix/sasl_passwd:

smtp.domain.com your.username@domain.com:YOUR.PASSWORD.HERE

Set the correct ownership permissions:

chown root:root /etc/postfix/sasl_passwd
chmod 0600 /etc/postfix/sasl_passwd

Now create an hashed db for the credentials set above:

postmap hash:/etc/postfix/sasl_passwd

Here you go! Now turn off sendmail (which is the default mail transport agent on CentOS installations) and switch on postfix:

chkconfig sendmail off
chkconfig postfix on
/etc/init.d/sendmail stop
/etc/init.d/postfix start

In order to test outgoing mail service is working you may refer to my previous post while tailing on another shell the mail log as follows:

tail -f /var/log/maillog

** enjoy! **