Send emails from postfix using mandrill or sendgrid
Send emails from postfix using mandrill or sendgrid
After installing and configuring postfix, add this to the /etc/postfix/main.cf
relayhost = [smtp.sendgrid.net]:2525
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
header_size_limit = 4096000
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
header_size_limit = 4096000
smtp_sasl_security_options = noanonymous
or
relayhost = [smtp.mandrillapp.com]:587
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
header_size_limit = 4096000
smtp_sasl_security_options = noanonymous
Create file /etc/postfix/sasl_passwd
and add inside
[smtp.sendgrid.net]:587 USERNAME:PASSWORD
or
[smtp.mandrillapp.com]:587 USERNAME:API_KEY
Protect the files changing to DB:
postmap /etc/postfix/sasl_passwd
now you can delete sasl_passwd because there is sasl_passwd.db file
If there is error:
postfix/smtp[8513]: warning: SASL authentication failure: No worthy mechs found
postfix/smtp[8513]: 53D0B943C184: SASL authentication failed; cannot authenticate to server smtp.mandrillapp.com[13.230.227.99]: no mechanism available
postfix/smtp[8513]: warning: SASL authentication failure: No worthy mechs found
status=deferred (SASL authentication failed; cannot authenticate to server smtp.mandrillapp.com[52.194.230.131]: no mechanism available)
postfix/smtp[8513]: 53D0B943C184: SASL authentication failed; cannot authenticate to server smtp.mandrillapp.com[13.230.227.99]: no mechanism available
postfix/smtp[8513]: warning: SASL authentication failure: No worthy mechs found
status=deferred (SASL authentication failed; cannot authenticate to server smtp.mandrillapp.com[52.194.230.131]: no mechanism available)
You have to install cyrus-sasl libraries.
yum install libgsasl cyrus-sasl-lib cyrus-sasl-plain cyrus-sasl
Comments
Post a Comment