Configure Postfix Server as a Relay on CentOS

Install Postfix and ensure that the service is enabled:
# yum install postfix cyrus-sasl-plain
# systemctl enable postfix
In case Sendmail is installed, remove it:
# yum remove -y sendmail*


Configure Postfix Server as a Relay

Note that this section applies to both servers. Open /etc/postfix/main.cf for editing and configure the following:
relayhost = mail1.goyun.info
fallback_relay = mail2.goyun.info
Create a new file /etc/postfix/sasl_passwd and add the authentication details of the external SMTP server:
mail1.goyun.info:587 goyun.info@my-repay-server.com:passwd
Prevent non-root access:
# chmod 0600 /etc/postfix/sasl_passwd
Create a database file:
# postmap /etc/postfix/sasl_passwd
Check configuration and restart Postfix service:
# postfix check
# systemctl restart postfix
Test it:
# echo test|mailx -s TEST receiver@goyun.info

Comments

Popular posts from this blog

Check MySQL query history from command line

Installing chocolatey on Windows