Procedure to Enable SMTP Client Authentication
Use the following steps to configure Postfix to provide a login and password when relaying mail. In this example, you’ll set up two different passwords for Postfix to authenticate when relaying through any server for the domain ora.com and through a host called mail.postfix.org:
Create a file called /etc/postfix/sasl_passwd with entries for each host, login, and password combination you need. Your file should resemble the following:
ora.com kdent:Rumpelstiltskin mail.postfix.org kyle:quixote
Execute postmap on the file:
# postmap /etc/postfix/sasl_passwd
Edit main.cf to turn on client authentication. Notice that you are now setting smtp_sasl_auth_enable instead of smtpd_sasl_auth_enable as you did to turn on authentication at the server. You must also set smtp_sasl_password_maps to point to the password file you created:
smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
Reload Postfix so that it recognizes the changes in its main.cf configuration file:
# postfix reload
Now, when the Postfix SMTP client attempts to relay messages through any of the domains or hosts listed in /etc/postfix/sasl_passwd, it will offer the corresponding authentication credentials. For example, if your Postfix smtp client connects to the server mail.ora.com, it authenticates with the username kdent and the password Rumpelstiltskin.