我已经按照他们的集成指南将 postfix 配置为将邮件中继到 Amazon SES,并且发送电子邮件没有问题。
但是,我最近使用框架编写了一个 PHP 应用程序,该应用程序产生了格式错误的电子邮件消息。
SES 以“554 Transaction failed: Expected MIME type, got =”拒绝电子邮件,这是可以接受的。
但是,我的本地 postfix 服务器然后尝试发送一个带有 from=<> 的发件人未送达通知,该通知被推送到中继地址。
SES 拒绝说明“501 提供的邮件发件人地址无效(回复邮件发件人命令))”并且后缀从队列中删除退回邮件。
问题是,确保收到发送给我的原始 554 退回邮件的更简单方法是什么?我没有看到让 SES 中继接受字段中的空值的方法,所以我相信解决方案在于配置 postfix 以将退回消息直接发送给我。
请注意,我可能错误地使用了术语“退回邮件”。邮件可能被拒绝,但我不确定这种情况下的正确命名法。关键是该消息没有被 SES 中继接受,所以它实际上并没有“走出门”,可以这么说。
6 月 12 日 03:11:21 myserver postfix/smtp[6353]:411BA21795:to=
6 月 12 日 03:11:21 myserver postfix/cleanup[6351]: 93F202179B: message-id=
6 月 12 日 03:11:21 myserver postfix/qmgr[895]: 93F202179B: from=<>, size=4673, nrcpt=1 (queue active)
6 月 12 日 03:11:21 myserver postfix/bounce[6354]:411BA21795:发件人未送达通知:93F202179B
6 月 12 日 03:11:21 myserver postfix/qmgr[895]:411BA21795:已删除
6 月 12 日 03:11:21 myserver postfix/smtp[6353]:93F202179B:to=
6 月 12 日 03:11:21 myserver postfix/qmgr[895]:93F202179B:已删除
最佳答案
如果您只需要将 Postfix 退回邮件发送到您的收件箱,只需设置下一个退回相关的配置参数(Ubuntu 的/etc/postfix/main.cf 文件):
# The list of error classes that are reported
notify_classes = bounce, delay, policy, protocol, resource, software
# The recipient of postmaster bounce notifications
bounce_notice_recipient = bounceuser
# The recipient of postmaster notifications about mail delivery problems that
# are caused by policy, resource, software or protocol errors.
error_notice_recipient = bounceuser
# The recipient of postmaster notifications with the message headers of mail
# that cannot be delivered within $delay_warning_time time units
delay_notice_recipient = bounceuser
退回用户是将收到退回相关邮件的收件人。如果您需要将消息转发给非本地收件人,只需编辑/etc/aliases 以使 postfix 将消息转发给您:
# /dev/null will just delete the message from local
bounceuser: /dev/null, <YOUR_EMAIL_ADDRESS_HERE>
不要忘记重新创建别名数据库并重新启动 postfix 服务:
sudo newaliases
sudo service postfix restart
^_^
关于amazon-web-services - 如何使用带有 Postfix 的 AWS SES 接收退回的邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24179706/