Installing postfix on CentOS

Install sasl:

yum install cyrus-sasl-plain -y

Install Postfix with the following command:

yum install postfix

Open or create the /etc/postfix/sasl_passwd file, using your favorite text editor

vi /etc/postfix/sasl_passwd

modify with the following

[mail.isp.example]:587 username:password

create the hashed file with the following command

postmap /etc/postfix/sasl_passwd

give the right permissions

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

Open the /etc/postfix/main.cf file with your favorite text editor:

vi /etc/postfix/main.cf/etc/postfix/main.cf

Do the following changes:

# specify SMTP relay host
[mail.isp.example]:587
# enable SASL authentication
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication.
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption
smtp_use_tls = yes
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

restart the Postifix server issuing a

service postfix restart