PostFix per Username Authentication

To use an authenticated user:

  1. Create a password maps file, for example /etc/postfix/relay_passwd:
  2. smtp.smarthostname.demo-domain.invalid USERNAME:PASSWORD"

  3. Ensure the file has the correct permissions and to create the hash from the maps file by executing the following commands:
    • chown root:root /etc/postfix/relay_passwd
    • chmod 600 /etc/postfix/relay_passwd
    • postmap /etc/postfix/relay_passwd
  4. Add the following line to /etc/postfix/main.cf
  5. relayhost = SMARTHOST:587

  6. Finally add the following to /etc/postfix/main.cf below the relayhost = line:
  7. smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd
    smtp_sasl_security_options =

  8. Restart Postfix for the changes to take effect using /etc/init.d/postfix restart