我有一个发送只有后缀MTAconfiguration,允许从@ example.com发送
当发生反弹时,我想用脚本处理。
我按照这个答案给出的步骤: https : //serverfault.com/a/735721/444076
我的脚本得到正确调用,但发件人地址仍然收到反弹的电子邮件。 我怎样才能防止发生?
main.cf
mydestination = bounce.example.com, localhost # BOUNCE CONFIG notify_classes = bounce bounce_notice_recipient = [email protected] transport_maps = hash:/etc/postfix/transport_maps bounce_size_limit = 1
transport_maps
# when you make changes to this file, run: # sudo postmap /etc/postfix/transport_maps [email protected] bulkbounce:
master.cf
bulkbounce unix - nn - - pipe flags=FRq user=nouser argv=/path/to/bouncescript.sh
然而,发送一个像(有效的,无效的rcpt)的邮件:
FROM: [email protected] TO: [email protected] SUBJECT: ... ...
结果在我的脚本被称为(好)和[email protected]收到一封电子邮件与退回消息(不想)。
我如何禁用? 或者我错过了什么。
示例日志:
Nov 16 17:27:32 dev postfix/smtpd[6654]: connect from localhost[::1] Nov 16 17:27:32 dev postfix/smtpd[6654]: 486FED9F98: client=localhost[::1] Nov 16 17:27:32 dev postfix/cleanup[6658]: 486FED9F98: message-id=<[email protected]> Nov 16 17:27:32 dev postfix/qmgr[6652]: 486FED9F98: from=<someuser@example>, size=544, nrcpt=1 (queue active) Nov 16 17:27:32 dev postfix/smtpd[6654]: disconnect from localhost[::1] Nov 16 17:28:13 dev postfix/smtp[6659]: 486FED9F98: to=<[email protected]>, relay=tribulant.com[23.22.38.89]:25, delay=41, delays=0.05/0.02/21/20, dsn=5.0.0, status=bounced (host tribulant.com[23.22.38.89] said: 550 No such person at this address. (in reply to RCPT TO command)) Nov 16 17:28:13 dev postfix/cleanup[6658]: 7604CD9F9D: message-id=<[email protected]> Nov 16 17:28:13 dev postfix/qmgr[6652]: 7604CD9F9D: from=<>, size=2984, nrcpt=1 (queue active) Nov 16 17:28:13 dev postfix/bounce[6693]: 486FED9F98: sender non-delivery notification: 7604CD9F9D Nov 16 17:28:13 dev postfix/cleanup[6658]: 76DAED9F9E: message-id=<[email protected]> Nov 16 17:28:13 dev postfix/qmgr[6652]: 76DAED9F9E: from=<[email protected]>, size=2599, nrcpt=1 (queue active) Nov 16 17:28:13 dev postfix/bounce[6693]: 486FED9F98: postmaster non-delivery notification: 76DAED9F9E Nov 16 17:28:13 dev postfix/qmgr[6652]: 486FED9F98: removed Nov 16 17:28:13 dev postfix/smtp[6659]: 7604CD9F9D: to=<someuser@example>, relay=mx.mailprotect.be[178.208.39.141]:25, delay=0.08, delays=0/0/0.05/0.03, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as C0B5E4401F4) Nov 16 17:28:13 dev postfix/qmgr[6652]: 7604CD9F9D: removed Nov 16 17:28:13 dev postfix/pipe[6694]: 76DAED9F9E: to=<[email protected]>, relay=bulkbounce, delay=0.16, delays=0/0.01/0/0.15, dsn=2.0.0, status=sent (delivered via bulkbounce service) Nov 16 17:28:13 dev postfix/qmgr[6652]: 76DAED9F9E: removed
fqdn:app.example.com
现在我明白发生了什么事情,答案是显而易见的。
在RFC之后,MTA(应该)总是发送退回消息给发送者(如果设置了FROM或返回path)。
添加notify_classes不会改变这种行为,它会在其上添加行为。 (所以发送第二封邮件)
为了实现我想要的,只有脚本被调用,我删除了notify_classes和bounce_notice_recipient。 另外,我改变了我们的应用程序总是添加一个“返回path”标题与[email protected]
当发生反弹时,如果已经设置(现在是[email protected]),则MTA会向FROM或返回path发送退回消息。 由于此电子邮件已映射到transport_maps,因此它会被传送到脚本,并且不会实际发送电子邮件。 万岁