如何使用带有Postfix的AWS SES接收退回邮件

时间:2014-06-12 08:27:48

标签: amazon-web-services smtp postfix-mta amazon-ses email-bounces

我已将postfix配置为通过遵循其集成指南将邮件中继到Amazon SES,并且发送电子邮件正常运行。

但是,我最近使用一个生成格式错误的电子邮件的框架编写了一个PHP应用程序。

SES拒绝电子邮件" 554交易失败:预期的MIME类型,得到="这是可以接受的。

但是,我的本地后缀服务器会尝试使用from =<>发送发件人未送达通知。它会被推送到中继地址。

SES拒绝陈述" 501提供的MAIL FROM地址无效(回复MAIL FROM命令))"和postfix从队列中删除退回邮件。

问题是,确保我收到发送给我的原始554退回邮件的更简单方法是什么?我没有看到让SES继电器从字段中接受空的方法,所以我相信解决方案将在于配置postfix以直接向我发送退回消息。

请注意,我使用的是“反弹邮件”这个词。也许错了。邮件可能被拒绝,但我不确定这种情况的正确命名。关键点在于SES中继不接受该消息,因此它实际上并没有出现在门外。可以这么说。

Jun 12 03:11:21 myserver postfix/smtp[6353]: 411BA21795: to=<valid@validdomain.com>, relay=email-smtp.us-east-1.amazonaws.com[54.243.192.132]:25, delay=0.29, delays=0.05/0.02/0.15/0.07, dsn=5.0.0, status=bounced (host email-smtp.us-east-1.amazonaws.com[54.243    .192.132] said: 554 Transaction failed: Expected MIME type, got = (in reply to end of DATA command))
Jun 12 03:11:21 myserver postfix/cleanup[6351]: 93F202179B: message-id=
Jun 12 03:11:21 myserver postfix/qmgr[895]: 93F202179B: from=<>, size=4673, nrcpt=1 (queue active)
Jun 12 03:11:21 myserver postfix/bounce[6354]: 411BA21795: sender non-delivery notification: 93F202179B
Jun 12 03:11:21 myserver postfix/qmgr[895]: 411BA21795: removed

Jun 12 03:11:21 myserver postfix/smtp[6353]: 93F202179B: to=<valid@validdomain.com>, relay=email-smtp.us-east-1.amazona    ws.com[23.21.161.144]:25, delay=0.17, delays=0.01/0/0.15/0, dsn=5.0.0, status=bounced (host email-smtp.us-east-1.amazonaws.com[23.    21.161.144] said: 501 Invalid MAIL FROM address provided (in reply to MAIL FROM command))
Jun 12 03:11:21 myserver postfix/qmgr[895]: 93F202179B: removed

2 个答案:

答案 0 :(得分:0)

要收到绑定邮件,您必须设置在后缀安装本地传送的信封发件人地址。

检查

   postconf mydestination

查看哪些域是本地传递的。 然后,您的应用程序需要将信封发件人地址设置为有效的本地传送地址。像root@name.of.your.machine那样的东西

答案 1 :(得分:0)

如果您只需要将Postfix退回邮件发送到您的收件箱,只需设置下一个与退回相关的配置参数( /etc/postfix/main.cf 文件为Ubuntu):

# 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

bounceuser 是获得退回相关邮件的收件人。如果您需要将邮件转发给非本地收件人,只需编辑/ etc / aliases以使postfix将邮件转发给您:

# /dev/null will just delete the message from local
bounceuser: /dev/null, <YOUR_EMAIL_ADDRESS_HERE>

不要忘记重新创建别名数据库并重新启动后缀服务:

sudo newaliases
sudo service postfix restart

^ _ ^