I am trying to configure postfix for using relay host with the following in /etc/postfix/main.cf:
relayhost = [mailtrap.io]:2525
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
After sending email via telnet localhost 25
postfix log says:
Mar 20 10:49:52 hydra postfix/smtpd[19898]: connect from localhost[127.0.0.1]
Mar 20 10:49:52 hydra postfix/smtpd[19898]: improper command pipelining after MAIL from localhost[127.0.0.1]
Mar 20 10:49:52 hydra postfix/smtpd[19898]: 5F9BC2C30A1: client=localhost[127.0.0.1]
Mar 20 10:49:52 hydra postfix/cleanup[19902]: 5F9BC2C30A1: message-id=<20120320084952.5F9BC2C30A1@hydra>
Mar 20 10:49:52 hydra postfix/qmgr[19890]: 5F9BC2C30A1: from=<[email protected]>, size=290, nrcpt=1 (queue active)
Mar 20 10:49:52 hydra postfix/smtp[19904]: warning: SASL authentication failure: No worthy mechs found
Mar 20 10:49:52 hydra postfix/smtp[19904]: 5F9BC2C30A1: to=<[email protected]>, relay=mailtrap.io[176.9.59.220]:2525, delay=0.32, delays=0.19/0.01/0.13/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server mailtrap.io[176.9.59.220]: no mechanism available)
SMTP server(relayhost) log:
>>> EHLO hydra
250-Ok Helo 213.160.145.74, Mailtrap SMTP Server
250-AUTH PLAIN
250-NO-SOLICITING
250 SIZE 20000000
>>> QUIT
221 Ok
Any Ideas how to fix?
OS: ubuntu.
The issue is caused by the fact that default postfix SMTP security options doesn't allow to have unencrypted password.
The correct configuration in this case will be:
relayhost = [mailtrap.io]:2525
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd