1

I've configure postfix for mandrill as follows

in /etc/postfix/sasl_passwd [smtp.mandrillapp.com]:587 myusername:apikey

then ran postmap /etc/postfix/sasl_passwd

In /etc/postfix/main.cf I added

myhostname = webmail.mysite.com
mydestination = localhost

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous

relayhost = [smtp.mandrillapp.com]:587

But mail sending failed log shows SASL authentication failed; server smtp.mandrillapp.com[52.7.100.156] said: 435 4.7.8 Error: authentication failed:

Russell
  • 111
  • 1
  • 2

2 Answers2

1

I am using centos 7 Finally it works! I was getting this issue(tail -f /var/log/mailog):

to=<usmanali@example.com>, relay=smtp.sendgrid.net[169.45.113.201]:587, delay=0.3, delays=0.05/0.07/0.16/0.02, dsn=5.0.0, status=bounced (host smtp.sendgrid.net[169.45.113.201] said: 550 Unauthenticated senders not allowed (in reply to MAIL FROM command))

Then i changed file /etc/postfix/main.cf in this way that added following lines into end of file

mtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = 256000000

# Sendgrid Settings
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:apikey:SG.YOUR_SENDGRID_KEY
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

Then Installing postfix missing module dependency using:

sudo yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain

Then restarting postfix

sudo systemctl restart  postfix.service
Usman Ali Maan
  • 232
  • 1
  • 7
0

In your smtp_sasl_password_maps map, the key should be only the hostname, without brackets or port number.

smtp.mandrillapp.com    nikolas@example.com:Y1gkQRajCjusxkvEXwv1Z
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972