Postfix在拒绝时不发送反弹

我在专用服务器上安装了Postfix(2.6)。

当我尝试发送邮件到一个不存在的域,我在我的mail.log中得到这一行:

postfix/smtpd[11069]: NOQUEUE: reject: RCPT from [..omitted..][xxxx]: 450 4.1.2 <[email protected]>: Recipient address rejected: Domain not found; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<test.mydomain.com> 

在我的configuration中,我有:

 smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, reject_invalid_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, check_client_access hash:/etc/postfix/rbl_override,permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_rbl_client tor.dnsbl.sectoor.de=127.0.0.1 

所以,邮件日志中的错误是正确的。 目前这封电子邮件并没有排队,并被拒绝。

有没有办法向发件人发送拒绝邮件(发送状态通知?)(例如[email protected])?

你可以使用notify_classes

 # main.cf error_notice_recipient = [email protected] notify_classes = resource, software, policy 

发送一个简单的邮件

 # echo "Hello world" | swaks -4 --server localhost --from [email protected] --to [email protected] --h-Subject "Test message" --body - === Trying localhost:25... === Connected to localhost. <- 220 smtp.example.net ESMTP Postfix -> EHLO jenkins.example.net <- 250-smtp.example.net <- 250-PIPELINING <- 250-SIZE 10240000 <- 250-VRFY <- 250-ETRN <- 250-ENHANCEDSTATUSCODES <- 250-8BITMIME <- 250 DSN -> MAIL FROM:<[email protected]> <- 250 2.1.0 Ok -> RCPT TO:<[email protected]> <** 450 4.1.2 <[email protected]>: Recipient address rejected: Domain not found -> QUIT <- 221 2.0.0 Bye === Connection closed with remote host. 

检查邮件日志

 # cat /var/log/maillog Mar 18 14:47:32 ci postfix/postfix-script[24049]: starting the Postfix mail system Mar 18 14:47:32 ci postfix/master[24050]: daemon started -- version 2.6.6, configuration /etc/postfix Mar 18 14:47:34 ci postfix/smtpd[24057]: connect from localhost[127.0.0.1] Mar 18 14:47:34 ci postfix/smtpd[24057]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 450 4.1.2 <[email protected]>: Recipient address rejected: Domain not found; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<jenkins.example.net> Mar 18 14:47:34 ci postfix/cleanup[24060]: 2543E1C0979: message-id=<[email protected]> Mar 18 14:47:34 ci postfix/smtpd[24057]: disconnect from localhost[127.0.0.1] Mar 18 14:47:34 ci postfix/qmgr[24053]: 2543E1C0979: from=<[email protected]>, size=922, nrcpt=1 (queue active) Mar 18 14:47:34 ci postfix/virtual[24061]: 2543E1C0979: to=<[email protected]>, orig_to=<[email protected]>, relay=virtual, delay=0.05, delays=0.03/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to maildir) Mar 18 14:47:34 ci postfix/qmgr[24053]: 2543E1C0979: removed 

您将收到类似以下的内容

 Return-Path: <[email protected]> X-Original-To: [email protected] Delivered-To: [email protected] Received: by smtp.example.net (Postfix) id 2543E1C0979; Fri, 18 Mar 2016 14:47:34 +0000 (UTC) Date: Fri, 18 Mar 2016 14:47:34 +0000 (UTC) From: [email protected] (Mail Delivery System) To: [email protected] (Postmaster) Subject: Postfix SMTP server: errors from localhost[127.0.0.1] Message-Id: <[email protected]> Transcript of session follows. Out: 220 smtp.example.net ESMTP Postfix In: EHLO jenkins.example.net Out: 250-smtp.example.net Out: 250-PIPELINING Out: 250-SIZE 10240000 Out: 250-VRFY Out: 250-ETRN Out: 250-ENHANCEDSTATUSCODES Out: 250-8BITMIME Out: 250 DSN In: MAIL FROM:<[email protected]> Out: 250 2.1.0 Ok In: RCPT TO:<[email protected]> Out: 450 4.1.2 <[email protected]>: Recipient address rejected: Domain not found In: QUIT Out: 221 2.0.0 Bye For other details, see the local mail logfile