我在一台服务器上运行多个网站。我正在使用 sendgrid 发送我的电子邮件。
现在,我使用 smtp_sasl 进行身份验证,将所有外发邮件中继到单个 sendgrid 帐户。
我需要能够将每个域的电子邮件发送到不同的 sendgrid 帐户。因此,对于 domain1.com,我想使用一个帐户中继到 sendgrid,而对于 domain2.com,我需要 postfix 以使用不同的帐户进行身份验证。
mc0*_*c0e 11
很遗憾,这个问题持续了这么久却没有一个正确的答案。就这件事而言,sendgrid 自己的文档没有处理它是一种耻辱。所需的指令在http://www.postfix.org/SASL_README.html#client_sasl_sender 中进行了简洁的处理,我将在此处引用,并进行一些特定于 sendgrid 的修改:
/etc/postfix/main.cf:
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
relayhost = my.default.relay.com
Run Code Online (Sandbox Code Playgroud)
/etc/postfix/sasl_passwd:
# Per-sender authentication; see also /etc/postfix/sender_relay.
@domain1.example.com username1:password1
@domain2.example.com username2:password2
# Login information for the default relayhost.
[my.default.relay.com] username:password
# Alternative form:
# [mail.isp.example]:submission username:password
Run Code Online (Sandbox Code Playgroud)
/etc/postfix/sender_relay:
# Per-sender provider; see also /etc/postfix/sasl_passwd.
@domain1.example.com [sendgrid.net]:submission
@domain2.example.com [sendgrid.net]:submission
Run Code Online (Sandbox Code Playgroud)
不过这里有一些注意事项。
| 归档时间: |
|
| 查看次数: |
14555 次 |
| 最近记录: |