让 Postfix 对邮件进行两次密件抄送

让 Postfix 对邮件进行两次密件抄送

我正在运行 Postfix 邮件服务器,为了扫描邮件,我将它们转发给 amavis,扫描完成后,amavis 将邮件转发给密文邮件(自动解密和加密电子邮件的程序)。Ciphermail 将邮件重新发送给 amavis,amavis 将邮件重新发送给 Postfix。

Ciphermail 与 postfix 和 amavis 在不同的服务器上运行。

我想要存档所有解密和加密的邮件,这意味着我想要在传递 ciphermail 之前和传递 ciphermail 之后分别存档一次。为此,我将以下内容插入到/etc/postfix/main.cf

    [email protected]

问题是每封邮件存档三次而不是两次。ciphermail 之前存档两次,ciphermail 之后存档一次。我的问题是为什么邮件在 ciphermail 之前发送两次,我如何调整 postfix 以在 ciphermail 之前和 ciphermail 之后分别发送一次邮件。

我已经尝试插入/etc/postfix/main.cf

    receive_override_options = no_address_mappings

但是现在邮件只是在 ciphermail 之后存档一次,如果我插入/etc/postfix/master.cf

    127.0.0.1:10029 inet n - n - - smtpd
      # [...]
      -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings

在 ciphermail 加密或解密邮件之前,只发送一次邮件副本。

邮件日志一封邮件发送3份设置:

Feb  3 13:30:25 email1mail postfix/submission/smtpd[3319]: connect from somewhere[xxx.xxx.xxx.xxx]
Feb  3 13:30:25 email1mail postfix/submission/smtpd[3319]: 47F943003E: client=somewhere[xxx.xxx.xxx.xxx], sasl_method=PLAIN, [email protected]
Feb  3 13:30:25 email1mail postfix/cleanup[3323]: 47F943003E: message-id=<[email protected]>
Feb  3 13:30:25 email1mail postfix/qmgr[3313]: 47F943003E: from=<[email protected]>, size=611, nrcpt=2 (queue active)
Feb  3 13:30:25 email1mail amavis[3061]: () loaded policy bank "BCM"
Feb  3 13:30:25 email1mail amavis[3061]: (03061-05) ESMTP:[127.0.0.1]:10024 /var/lib/amavis/tmp/amavis-20150203T130744-03061-ZTBAQ9iE: <[email protected]> -> <[email protected]>,<[email protected]> SIZE=611 Received: from email1mail.localdomain ([127.0.0.1]) by localhost (mail.example.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP; Tue,  3 Feb 2015 13:30:25 +0100 (CET)
Feb  3 13:30:25 email1mail postfix/submission/smtpd[3319]: disconnect from somewhere[xxx.xxx.xxx.xxx]
Feb  3 13:30:25 email1mail amavis[3061]: (03061-05) Checking: XP5xmOE51_t2 BCM [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>,<[email protected]>
Feb  3 13:30:25 email1mail amavis[3061]: (03061-05) Open relay? Nonlocal recips but not originating: [email protected]
Feb  3 13:30:25 email1mail amavis[3061]: (03061-05) p001 1 Content-Type: text/plain, size: 7 B, name: 
Feb  3 13:30:25 email1mail amavis[3061]: (03061-05) (!)run_av (ClamAV-clamd) FAILED - unexpected , output="/var/lib/amavis/tmp/amavis-20150203T130744-03061-ZTBAQ9iE/parts: lstat() failed: Permission denied. ERROR\n"
Feb  3 13:30:25 email1mail amavis[3061]: (03061-05) (!)ClamAV-clamd av-scanner FAILED: CODE(0x25d1328) unexpected , output="/var/lib/amavis/tmp/amavis-20150203T130744-03061-ZTBAQ9iE/parts: lstat() failed: Permission denied. ERROR\n" at (eval 136) line 899.
Feb  3 13:30:25 email1mail amavis[3061]: (03061-05) (!)WARN: all primary virus scanners failed, considering backups
Feb  3 13:30:46 email1mail amavis[3061]: (03061-05) FWD from <[email protected]> -> <[email protected]>,<[email protected]>, 250 2.6.0 from MTA(smtp:[192.168.1.102]:10026): 250 2.6.0 Message received
Feb  3 13:30:46 email1mail amavis[3061]: (03061-05) Passed CLEAN {RelayedInbound,RelayedOpenRelay}, BCM [xxx.xxx.xxx.xxx]:59491 [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>,<[email protected]>, Queue-ID: 47F943003E, Message-ID: <[email protected]>, mail_id: XP5xmOE51_t2, Hits: -1, size: 611, queued_as: 250 2.6.0 Message received, 21204 ms
Feb  3 13:30:46 email1mail amavis[3061]: (03061-05) TIMING-SA total 5175 ms - parse: 1.41 (0.0%), extract_message_metadata: 2.9 (0.1%), get_uri_detail_list: 0.24 (0.0%), tests_pri_-1000: 4.1 (0.1%), tests_pri_-950: 1.82 (0.0%), tests_pri_-900: 1.60 (0.0%), tests_pri_-400: 1.12 (0.0%), tests_pri_0: 5127 (99.1%), check_spf: 0.44 (0.0%), check_dkim_adsp: 41 (0.8%), check_razor2: 5001 (96.6%), check_pyzor: 59 (1.1%), tests_pri_500: 4.2 (0.1%), learn: 20 (0.4%), b_learn: 17 (0.3%), b_count_change: 6 (0.1%), get_report: 0.42 (0.0%)
Feb  3 13:30:46 email1mail postfix/smtp[3324]: 47F943003E: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=21, delays=0.07/0.01/0/21, dsn=2.6.0, status=sent (250 2.6.0 from MTA(smtp:[192.168.1.102]:10026): 250 2.6.0 Message received)
Feb  3 13:30:46 email1mail postfix/smtp[3324]: 47F943003E: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=21, delays=0.07/0.01/0/21, dsn=2.6.0, status=sent (250 2.6.0 from MTA(smtp:[192.168.1.102]:10026): 250 2.6.0 Message received)
Feb  3 13:30:46 email1mail postfix/qmgr[3313]: 47F943003E: removed
Feb  3 13:30:46 email1mail amavis[3061]: (03061-05) size: 611, TIMING [total 21209 ms] - SMTP greeting: 2 (0%)0, SMTP EHLO: 1 (0%)0, SMTP pre-MAIL: 1 (0%)0, SMTP pre-DATA-flush: 2 (0%)0, SMTP DATA: 37 (0%)0, check_init: 0 (0%)0, digest_hdr: 1 (0%)0, digest_body_dkim: 0 (0%)0, mime_decode: 8 (0%)0, get-file-type1: 36 (0%)0, parts_decode: 0 (0%)0, check_header: 1 (0%)0, AV-scan-1: 23 (0%)1, AV-scan-2: 15812 (75%)75, spam-wb-list: 2 (0%)75, SA parse: 3 (0%)75, SA check: 5171 (24%)99, decide_mail_destiny: 4 (0%)100, notif-quar: 0 (0%)100, fwd-connect: 47 (0%)100, fwd-xforward: 2 (0%)100, fwd-mail-pip: 1 (0%)100, fwd-rcpt-pip: 37 (0%)100, fwd-data-chkpnt: 0 (0%)100, write-header: 1 (0%)100, fwd-data-contents: 0 (0%)100, fwd-end-chkpnt: 5 (0%)100, prepare-dsn: 1 (0%)100, main_log_entry: 7 (0%)100, update_snmp: 2 (0%)100, SMTP pre-response: 0 (0%)100, SMTP response: 0 (0%)100, unlink-1-files: 0 (0%)100, rundown: 1 (0%)100
Feb  3 13:30:47 email1mail amavis[3060]: () loaded policy bank "ACM"
Feb  3 13:30:47 email1mail amavis[3060]: (03060-06) ESMTP:[192.168.2.10]:10028 /var/lib/amavis/tmp/amavis-20150203T130722-03060-gusE2h0r: <[email protected]> -> <[email protected]> Received: from ciphermail ([192.168.1.102]) by localhost (mail.example.com [192.168.2.10]) (amavisd-new, port 10028) with ESMTP for <[email protected]>; Tue,  3 Feb 2015 13:30:47 +0100 (CET)
Feb  3 13:30:47 email1mail amavis[3060]: (03060-06) Checking: l6papfJwmT6R ACM [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>
Feb  3 13:30:47 email1mail amavis[3060]: (03060-06) Open relay? Nonlocal recips but not originating: [email protected]
Feb  3 13:30:47 email1mail amavis[3060]: (03060-06) p001 1 Content-Type: text/plain, size: 7 B, name: 
Feb  3 13:30:47 email1mail amavis[3060]: (03060-06) (!)run_av (ClamAV-clamd) FAILED - unexpected , output="/var/lib/amavis/tmp/amavis-20150203T130722-03060-gusE2h0r/parts: lstat() failed: Permission denied. ERROR\n"
Feb  3 13:30:47 email1mail amavis[3060]: (03060-06) (!)ClamAV-clamd av-scanner FAILED: CODE(0x25d1328) unexpected , output="/var/lib/amavis/tmp/amavis-20150203T130722-03060-gusE2h0r/parts: lstat() failed: Permission denied. ERROR\n" at (eval 136) line 899.
Feb  3 13:30:47 email1mail amavis[3060]: (03060-06) (!)WARN: all primary virus scanners failed, considering backups
Feb  3 13:30:47 email1mail amavis[3061]: () loaded policy bank "ACM"
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) ESMTP:[192.168.2.10]:10028 /var/lib/amavis/tmp/amavis-20150203T130744-03061-ZTBAQ9iE: <[email protected]> -> <[email protected]> Received: from ciphermail ([192.168.1.102]) by localhost (mail.example.com [192.168.2.10]) (amavisd-new, port 10028) with ESMTP for <[email protected]>; Tue,  3 Feb 2015 13:30:47 +0100 (CET)
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) Checking: cD-pyG9zKnpK ACM [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) p003 1 Content-Type: multipart/encrypted
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) p001 1/1 Content-Type: application/pgp-encrypted, size: 11 B, name: 
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) p002 1/2 Content-Type: application/octet-stream, size: 469 B, name: encrypted.asc
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) (!)run_av (ClamAV-clamd) FAILED - unexpected , output="/var/lib/amavis/tmp/amavis-20150203T130744-03061-ZTBAQ9iE/parts: lstat() failed: Permission denied. ERROR\n"
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) (!)ClamAV-clamd av-scanner FAILED: CODE(0x25d1328) unexpected , output="/var/lib/amavis/tmp/amavis-20150203T130744-03061-ZTBAQ9iE/parts: lstat() failed: Permission denied. ERROR\n" at (eval 136) line 899.
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) (!)WARN: all primary virus scanners failed, considering backups
Feb  3 13:31:08 email1mail postfix/smtpd[3340]: connect from localhost[127.0.0.1]
Feb  3 13:31:08 email1mail postfix/smtpd[3340]: 96AC730057: client=localhost[127.0.0.1]
Feb  3 13:31:08 email1mail postfix/cleanup[3323]: 96AC730057: message-id=<[email protected]>
Feb  3 13:31:08 email1mail postfix/qmgr[3313]: 96AC730057: from=<[email protected]>, size=2357, nrcpt=2 (queue active)
Feb  3 13:31:08 email1mail amavis[3061]: (03061-06) FWD from <[email protected]> -> <[email protected]>,BODY=7BIT 250 2.0.0 from MTA(smtp:[127.0.0.1]:10029): 250 2.0.0 Ok: queued as 96AC730057
Feb  3 13:31:08 email1mail amavis[3061]: (03061-06) Passed UNCHECKED {RelayedTaggedInbound}, ACM [xxx.xxx.xxx.xxx] [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: cD-pyG9zKnpK, Hits: -1, size: 1860, queued_as: 96AC730057, 21510 ms
Feb  3 13:31:08 email1mail amavis[3061]: (03061-06) TIMING-SA total 5298 ms - parse: 1.68 (0.0%), extract_message_metadata: 4.6 (0.1%), get_uri_detail_list: 0.20 (0.0%), tests_pri_-1000: 4.0 (0.1%), tests_pri_-950: 1.78 (0.0%), tests_pri_-900: 1.46 (0.0%), tests_pri_-400: 1.19 (0.0%), tests_pri_0: 5241 (98.9%), check_spf: 0.50 (0.0%), check_dkim_adsp: 41 (0.8%), check_razor2: 5001 (94.4%), check_pyzor: 171 (3.2%), tests_pri_500: 4.3 (0.1%), learn: 24 (0.5%), b_learn: 23 (0.4%), b_count_change: 9 (0.2%), get_report: 0.40 (0.0%)
Feb  3 13:31:08 email1mail amavis[3061]: (03061-06) size: 1860, TIMING [total 21515 ms] - SMTP greeting: 2 (0%)0, SMTP EHLO: 1 (0%)0, SMTP pre-MAIL: 3 (0%)0, SMTP pre-DATA-flush: 3 (0%)0, SMTP DATA: 2 (0%)0, check_init: 0 (0%)0, digest_hdr: 1 (0%)0, digest_body_dkim: 0 (0%)0, mime_decode: 11 (0%)0, get-file-type2: 31 (0%)0, parts_decode: 0 (0%)0, check_header: 1 (0%)0, AV-scan-1: 4 (0%)0, AV-scan-2: 16064 (75%)75, spam-wb-list: 4 (0%)75, SA parse: 3 (0%)75, SA check: 5295 (25%)100, decide_mail_destiny: 4 (0%)100, notif-quar: 0 (0%)100, fwd-connect: 64 (0%)100, fwd-mail-pip: 3 (0%)100, fwd-rcpt-pip: 0 (0%)100, fwd-data-chkpnt: 0 (0%)100, write-header: 0 (0%)100, fwd-data-contents: 0 (0%)100, fwd-end-chkpnt: 4 (0%)100, prepare-dsn: 0 (0%)100, main_log_entry: 9 (0%)100, update_snmp: 1 (0%)100, SMTP pre-response: 1 (0%)100, SMTP response: 0 (0%)100, unlink-3-files: 0 (0%)100, rundown: 1 (0%)100
Feb  3 13:31:08 email1mail dovecot: lmtp(3344): Connect from local
Feb  3 13:31:08 email1mail dovecot: lmtp(3344, [email protected]): RXUSJ4y/0FQQDQAAXzmN0w: msgid=<[email protected]>: saved mail to INBOX
Feb  3 13:31:08 email1mail dovecot: lmtp(3344): Disconnect from local: Successful quit
Feb  3 13:31:08 email1mail postfix/lmtp[3342]: 96AC730057: to=<[email protected]>, relay=email1mail.localdomain[private/dovecot-lmtp], delay=0.05, delays=0.01/0.02/0.01/0.01, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> RXUSJ4y/0FQQDQAAXzmN0w Saved)
Feb  3 13:31:08 email1mail postfix/smtp[3343]: 96AC730057: to=<[email protected]>, relay=archiv.example.com[192.168.1.103]:25, delay=0.11, delays=0.01/0.02/0.06/0.02, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 2138426503)
Feb  3 13:31:08 email1mail postfix/qmgr[3313]: 96AC730057: removed
Feb  3 13:31:09 email1mail postfix/smtpd[3345]: connect from localhost[127.0.0.1]
Feb  3 13:31:09 email1mail postfix/smtpd[3345]: A4AEC3005E: client=localhost[127.0.0.1]
Feb  3 13:31:09 email1mail postfix/cleanup[3323]: A4AEC3005E: message-id=<[email protected]>
Feb  3 13:31:09 email1mail postfix/smtpd[3345]: disconnect from localhost[127.0.0.1]
Feb  3 13:31:09 email1mail postfix/qmgr[3313]: A4AEC3005E: from=<[email protected]>, size=1358, nrcpt=2 (queue active)
Feb  3 13:31:09 email1mail amavis[3060]: (03060-06) FWD from <[email protected]> -> <[email protected]>,BODY=7BIT 250 2.0.0 from MTA(smtp:[127.0.0.1]:10029): 250 2.0.0 Ok: queued as A4AEC3005E
Feb  3 13:31:09 email1mail amavis[3060]: (03060-06) Passed CLEAN {RelayedOpenRelay}, ACM [xxx.xxx.xxx.xxx] [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: l6papfJwmT6R, Hits: -1, size: 871, queued_as: A4AEC3005E, 22636 ms
Feb  3 13:31:09 email1mail amavis[3060]: (03060-06) TIMING-SA total 6377 ms - parse: 1.67 (0.0%), extract_message_metadata: 5 (0.1%), get_uri_detail_list: 1.71 (0.0%), tests_pri_-1000: 4.2 (0.1%), tests_pri_-950: 1.85 (0.0%), tests_pri_-900: 1.54 (0.0%), tests_pri_-400: 1.20 (0.0%), tests_pri_0: 5226 (81.9%), check_spf: 0.40 (0.0%), check_dkim_adsp: 41 (0.6%), check_razor2: 5001 (78.4%), check_pyzor: 158 (2.5%), tests_pri_500: 4.1 (0.1%), learn: 1120 (17.6%), b_learn: 1117 (17.5%), get_report: 0.43 (0.0%)
Feb  3 13:31:09 email1mail amavis[3060]: (03060-06) size: 871, TIMING [total 22642 ms] - SMTP greeting: 2 (0%)0, SMTP EHLO: 1 (0%)0, SMTP pre-MAIL: 5 (0%)0, SMTP pre-DATA-flush: 3 (0%)0, SMTP DATA: 2 (0%)0, check_init: 0 (0%)0, digest_hdr: 1 (0%)0, digest_body_dkim: 0 (0%)0, mime_decode: 7 (0%)0, get-file-type1: 25 (0%)0, parts_decode: 0 (0%)0, check_header: 1 (0%)0, AV-scan-1: 3 (0%)0, AV-scan-2: 16164 (71%)72, spam-wb-list: 2 (0%)72, SA parse: 3 (0%)72, SA check: 6373 (28%)100, decide_mail_destiny: 4 (0%)100, notif-quar: 0 (0%)100, fwd-connect: 25 (0%)100, fwd-mail-pip: 2 (0%)100, fwd-rcpt-pip: 0 (0%)100, fwd-data-chkpnt: 0 (0%)100, write-header: 1 (0%)100, fwd-data-contents: 0 (0%)100, fwd-end-chkpnt: 4 (0%)100, prepare-dsn: 1 (0%)100, main_log_entry: 8 (0%)100, update_snmp: 3 (0%)100, SMTP pre-response: 0 (0%)100, SMTP response: 0 (0%)100, unlink-1-files: 0 (0%)100, rundown: 1 (0%)100
Feb  3 13:31:09 email1mail postfix/smtp[3343]: A4AEC3005E: to=<[email protected]>, relay=archiv.example.com[192.168.1.103]:25, delay=0.08, delays=0.01/0/0.06/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 26BF726509)
Feb  3 13:31:09 email1mail postfix/qmgr[3313]: A4AEC3005E: removed

这里是邮件日志形成存档邮件服务器

Feb  3 15:03:28 archiv postfix/smtpd[3185]: connect from unknown[192.168.2.10]
Feb  3 15:03:28 archiv postfix/smtpd[3185]: 7A2A9265BA: client=unknown[192.168.2.10]
Feb  3 15:03:28 archiv postfix/cleanup[3192]: 7A2A9265BA: message-id=<[email protected]>
Feb  3 15:03:28 archiv postfix/qmgr[3125]: 7A2A9265BA: from=<[email protected]>, size=1567, nrcpt=1 (queue active)
Feb  3 15:03:28 archiv postfix/smtpd[3185]: disconnect from unknown[192.168.2.10]
Feb  3 15:03:28 archiv dovecot: lmtp(3195): Connect from local
Feb  3 15:03:28 archiv dovecot: lmtp(3195, [email protected]): 4OXSHjDV0FR7DAAAKaROBA: msgid=<[email protected]>: saved mail to INBOX
Feb  3 15:03:28 archiv postfix/lmtp[3194]: 7A2A9265BA: to=<[email protected]>, relay=archiv.localdomain[private/dovecot-lmtp], delay=0.05, delays=0.01/0.01/0/0.02, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> 4OXSHjDV0FR7DAAAKaROBA Saved)
Feb  3 15:03:28 archiv dovecot: lmtp(3195): Disconnect from local: Successful quit
Feb  3 15:03:28 archiv postfix/qmgr[3125]: 7A2A9265BA: removed
Feb  3 15:03:28 archiv postfix/smtpd[3185]: connect from unknown[192.168.2.10]
Feb  3 15:03:28 archiv postfix/smtpd[3185]: 96F93265BD: client=unknown[192.168.2.10]
Feb  3 15:03:28 archiv postfix/cleanup[3192]: 96F93265BD: message-id=<[email protected]>
Feb  3 15:03:28 archiv postfix/qmgr[3125]: 96F93265BD: from=<[email protected]>, size=1536, nrcpt=2 (queue active)
Feb  3 15:03:28 archiv dovecot: lmtp(3195): Connect from local
Feb  3 15:03:28 archiv postfix/smtpd[3185]: disconnect from unknown[192.168.2.10]
Feb  3 15:03:28 archiv dovecot: lmtp(3195, [email protected]): 5OXSHjDV0FR7DAAAKaROBA: msgid=<[email protected]>: saved mail to INBOX
Feb  3 15:03:28 archiv postfix/lmtp[3194]: 96F93265BD: to=<[email protected]>, relay=archiv.localdomain[private/dovecot-lmtp], delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> 5OXSHjDV0FR7DAAAKaROBA Saved)
Feb  3 15:03:28 archiv postfix/lmtp[3194]: 96F93265BD: to=<[email protected]>, relay=archiv.localdomain[private/dovecot-lmtp], delay=0.02, delays=0/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> 5OXSHjDV0FR7DAAAKaROBA Saved)
Feb  3 15:03:28 archiv dovecot: lmtp(3195, [email protected]): 5OXSHjDV0FR7DAAAKaROBA: msgid=<[email protected]>: saved mail to INBOX
Feb  3 15:03:28 archiv dovecot: lmtp(3195): Disconnect from local: Successful quit
Feb  3 15:03:28 archiv postfix/qmgr[3125]: 96F93265BD: removed

答案1

免责声明:此答案不包含有关如何使 postfix 密件抄送两次电子邮件的解决方案。我只是解读了您的邮件日志行的内容。

Postfix 部分 pre-content_filter

Feb  3 13:30:25 email1mail postfix/submission/smtpd[3319]: connect from somewhere[xxx.xxx.xxx.xxx]
Feb  3 13:30:25 email1mail postfix/submission/smtpd[3319]: 47F943003E: client=somewhere[xxx.xxx.xxx.xxx], sasl_method=PLAIN, [email protected]
Feb  3 13:30:25 email1mail postfix/cleanup[3323]: 47F943003E: message-id=<[email protected]>

Postfix 接收来自[电子邮件保护]并分配队列 ID 47F943003E

Feb  3 13:30:25 email1mail postfix/qmgr[3313]: 47F943003E: from=<[email protected]>, size=611, nrcpt=2 (queue active)

此时,postfix 已将您的电子邮件设为密件抄送。因此 nrcpt 的值为 2,而不是 1。

Feb  3 13:30:46 email1mail postfix/smtp[3324]: 47F943003E: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=21, delays=0.07/0.01/0/21, dsn=2.6.0, status=sent (250 2.6.0 from MTA(smtp:[192.168.1.102]:10026): 250 2.6.0 Message received)
Feb  3 13:30:46 email1mail postfix/smtp[3324]: 47F943003E: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=21, delays=0.07/0.01/0/21, dsn=2.6.0, status=sent (250 2.6.0 from MTA(smtp:[192.168.1.102]:10026): 250 2.6.0 Message received)

上面两行再次证明 postfix 已经密送了你的邮件并且将其发送到内容过滤端口。

Amavis 部分预芯片邮件

Feb  3 13:30:25 email1mail amavis[3061]: (03061-05) ESMTP:[127.0.0.1]:10024 /var/lib/amavis/tmp/amavis-20150203T130744-03061-ZTBAQ9iE: <[email protected]> -> <[email protected]>,<[email protected]> SIZE=611 Received: from email1mail.localdomain ([127.0.0.1]) by localhost (mail.example.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP; Tue,  3 Feb 2015 13:30:25 +0100 (CET)

这是 amavis 收到两个收件人的电子邮件的证据。

Feb  3 13:30:46 email1mail amavis[3061]: (03061-05) Passed CLEAN {RelayedInbound,RelayedOpenRelay}, BCM [xxx.xxx.xxx.xxx]:59491 [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>,<[email protected]>, Queue-ID: 47F943003E, Message-ID: <[email protected]>, mail_id: XP5xmOE51_t2, Hits: -1, size: 611, queued_as: 250 2.6.0 Message received, 21204 ms

这是 amavis 将电子邮件(有两个收件人)转发给 chipermail 时的日志

Amavis 部分 post-chipermail

奇怪的是当 chipermail 转发回 amavis 时。Chipermail 将原始电子邮件拆分为两封电子邮件,每封电子邮件对应一个收件人。

Feb  3 13:30:47 email1mail amavis[3060]: (03060-06) ESMTP:[192.168.2.10]:10028 /var/lib/amavis/tmp/amavis-20150203T130722-03060-gusE2h0r: <[email protected]> -> <[email protected]> Received: from ciphermail ([192.168.1.102]) by localhost (mail.example.com [192.168.2.10]) (amavisd-new, port 10028) with ESMTP for <[email protected]>; Tue,  3 Feb 2015 13:30:47 +0100 (CET)
Feb  3 13:30:47 email1mail amavis[3061]: (03061-06) ESMTP:[192.168.2.10]:10028 /var/lib/amavis/tmp/amavis-20150203T130744-03061-ZTBAQ9iE: <[email protected]> -> <[email protected]> Received: from ciphermail ([192.168.1.102]) by localhost (mail.example.com [192.168.2.10]) (amavisd-new, port 10028) with ESMTP for <[email protected]>; Tue,  3 Feb 2015 13:30:47 +0100 (CET)

这是电子邮件分裂的证据。两封电子邮件由 amavis 从 chipermail 收到。

Feb  3 13:31:08 email1mail amavis[3061]: (03061-06) Passed UNCHECKED {RelayedTaggedInbound}, ACM [xxx.xxx.xxx.xxx] [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: cD-pyG9zKnpK, Hits: -1, size: 1860, queued_as: 96AC730057, 21510 ms

Amavis 将电子邮件(收件人为 carol)转发到 postfix,邮件 ID 为 96AC730057

Feb  3 13:31:09 email1mail amavis[3060]: (03060-06) Passed CLEAN {RelayedOpenRelay}, ACM [xxx.xxx.xxx.xxx] [xxx.xxx.xxx.xxx] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: l6papfJwmT6R, Hits: -1, size: 871, queued_as: A4AEC3005E, 22636 ms

Amavis 将电子邮件(带有收件人档案)转发到 Postfix,邮件 ID 为 A4AEC3005E

Postfix 部分 post-content_filter

Feb  3 13:31:08 email1mail postfix/smtpd[3340]: connect from localhost[127.0.0.1]
Feb  3 13:31:08 email1mail postfix/smtpd[3340]: 96AC730057: client=localhost[127.0.0.1]
Feb  3 13:31:08 email1mail postfix/cleanup[3323]: 96AC730057: message-id=<[email protected]>

Postfix 收到来自 amavis 的电子邮件,邮件 ID 为 96AC730057

Feb  3 13:31:08 email1mail postfix/qmgr[3313]: 96AC730057: from=<[email protected]>, size=2357, nrcpt=2 (queue active)

Postfix 将您的电子邮件设为密件抄送再次。你可以发现 nrcpt 的值为 2。

Feb  3 13:31:08 email1mail postfix/lmtp[3342]: 96AC730057: to=<[email protected]>, relay=email1mail.localdomain[private/dovecot-lmtp], delay=0.05, delays=0.01/0.02/0.01/0.01, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> RXUSJ4y/0FQQDQAAXzmN0w Saved)
Feb  3 13:31:08 email1mail postfix/smtp[3343]: 96AC730057: to=<[email protected]>, relay=archiv.example.com[192.168.1.103]:25, delay=0.11, delays=0.01/0.02/0.06/0.02, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 2138426503)

Postfix 不会再次将电子邮件发送到内容过滤器。它将 carol 的电子邮件发送到 dovecot,将 archiv 的电子邮件发送到 archiv 服务器

在另一部分

Feb  3 13:31:09 email1mail postfix/smtpd[3345]: connect from localhost[127.0.0.1]
Feb  3 13:31:09 email1mail postfix/smtpd[3345]: A4AEC3005E: client=localhost[127.0.0.1]
Feb  3 13:31:09 email1mail postfix/cleanup[3323]: A4AEC3005E: message-id=<[email protected]>

Postfix 收到来自 amavis 的电子邮件,邮件 ID 为 A4AEC3005E

Feb  3 13:31:09 email1mail postfix/qmgr[3313]: A4AEC3005E: from=<[email protected]>, size=1358, nrcpt=2 (queue active)

Postfix 将您的电子邮件设为密件抄送再次到自身。您可以发现 nrcpt 的值为 2。

Feb  3 13:31:09 email1mail postfix/smtp[3343]: A4AEC3005E: to=<[email protected]>, relay=archiv.example.com[192.168.1.103]:25, delay=0.08, delays=0.01/0/0.06/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 26BF726509)

Postfix 将具有两个重复收件人的电子邮件发送到存档服务器

可以看到,postfix 发送了三份邮件将其传递给 chipermail。您在存档服务器中的登录确认了此行为。


那么,我们如何才能密送电子邮件传递给 chipermail 吗?

现在,我还没有主意。问题是,postfix 总是将密件抄送的电子邮件传递给 content_filter(chipermail 和 amavis)。这种架构会阻止在将电子邮件传递给 content_filter 之前将其发送到密件抄送地址。

好的,我们怎样才能将唯一的一封电子邮件密送传递给 chipermail 吗?

您已经有解决方案了,放上receive_override_options = no_address_mappingsmain.cf。

相关内容