pinkeen.postfix-relay
安装和配置 postfix,将电子邮件中继到外部服务,如 mailgun、mailchimp、sendgrid 等。
在我看来,通常使用本地 postfix 作为邮件缓冲比直接通过 API 或 SMTP 从应用程序发送邮件要好,但你的经验可能会有所不同。
目前只支持一个中继,但 postfix 可以根据 envelope from
主机(relayhostsby
)来路由电子邮件,应该很容易进行调整。
变量:
postfix_relay_host
postfix_relay_username
postfix_relay_password
postfix_relay_port
多主机邮件路由注意事项
在 main.cf
中: sender_dependent_relayhost_maps = hash:/etc/postfix/relayhostsby
在 /etc/postfix/relayhostsby
中:
@fromhost1 [其他外部服务]
@fromhost2 [smtp.mandrillapp.com]:587
@fromhost3 [smtp.mandrillapp.com]:587
在 /etc/postfix/sasl_passwd
中:
@fromhost1 hostuser:hostpass
@fromhost2 mandrilluser:mandrillpass
@fromhost3 mandrilluser:mandrillpass
一些可能解决问题的其他选项:
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhostsby
smtp_sender_dependent_authentication = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_auth_enable = yes
smtp_use_tls = yes
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtp_tls_security_level = may
smtpd_tls_received_header = yes
tls_random_source = dev:/dev/urandom
smtpd_tls_security_level = may
smtp_use_tls = yes
smtp_sasl_security_options = noanonymous