postconf -e smtpd_recipient_restrictions="permit_mynetworks,reject_unauth_destination,reject_unknown_recipient_domain"

测试发现上现这个写法并没有起到我想要的作用,可能是规则应用逻辑上不是我理解的那样会把所有的规则检测一次,而是在某个规则适合了就终止检测了.所以需要写成下面的写法,因为它符合了permit_mynetworks?所以就不检测后面的条件了.

 postconf -e smtpd_recipient_restrictions="reject_unknown_recipient_domain,permit_mynetworks,reject_unauth_destination"

执行上面那句更改配置的命令即可

像这些规则类,在顺序上需要注意,如果顺序恰当,就会提高效率,因为前面的规则已经过滤掉大部分不合法的请求.

 

Specify a list of restrictions, separated by commas and/or whitespace.Continue long lines by starting the next line with whitespace.Restrictions are applied in the order as specified; the firstrestriction that matches wins.

看它的说明应该是只要..的关系,即跟||一样的判断逻辑

 

reject_unverified_recipient

表示直接在smtp交互时把已知不可达的,会被弹回的,域名不存在的拒绝,但是这个如果验证没配好话.就会出现smtp连接上了,但是交互命令发送过去后没有反应的问题.直到超时连接自动退出的情况.还有就是这将会占用系统很多资源

 

 

reject_unknown_recipient_domain:拒绝收件人域名不存在的请求;如果没有设置这个,postfix会先收信再检测发信.

-----telnet smtp 测试过程---------------------

 

from service@my.cn send to qidiziqidiiz@qidizid.com send fail:letter @ 0 to qidiziqidiiz@qidizid.com open 127.0.0.1:25 reponse: 220 mail.my.cn ESMTP Postfix (Ubuntu)

hello[my.cn]: 250 mail.my.cnno use smtp auth!


from[service@my.cn]: 250 2.1.0 Okto[qidiziqidiiz@qidizid.com]: 450 4.1.2 : Recipient address rejected: Domain not founddata[]: 554 5.5.1 Error: no valid recipients发送data命令返回:221 2.7.0 Error: I can break rules, too. Goodbye.


smtp出错: 221 2.7.0 Error: I can break rules, too. Goodbye.


发送失败使用 PHP SMTP. 系统不支持或未配置.


Date: Thu, 10 Nov 2011 14:53:09 +0800From: Return-Path: To: qidiziqidiiz@qidizid.comSubject: =?utf-8?B?5rWL6K+V?=Reply-To: "service@my.cn" X-Sender: service@my.cnX-Priority: 3 (Normal)Message-ID: <4ebb74d5a5d14@my.cn>Mime-Version: 1.0Content-Type: multipart/alternative; boundary="B_ALT_4ebb74d5a5d64"This is a multi-part message in MIME format.Your email application may not support this format.--B_ALT_4ebb74d5a5d64Content-Type: text/html; charset=utf-8Content-Transfer-Encoding: base64PHA+CgnmtYvor5U8L3A+PHA+PHA+PGNlbnRlcj48YSBocmVmPSdodHRwOi8vbXlocmQuY24vZWRtL2luZGV4LnBocC9ob21lL3N0YXRpc3Rpay91bnN1YnNjcmliZS8xLzAvY1dsa2FYcHBjV2xrYVdsNlFIRnBaR2w2YVdRdVkyOXQvMSc+54K55q2k6YCA6K6i6K6i6ZiFPC9hPjwvY2VudGVyPjwvcD48L3A+PGltZyBzcmM9Imh0dHA6Ly9teWhyZC5jbi9lZG0vaW5kZXgucGhwL2hvbWUvc3RhdGlzdGlrL2ltZy8xLzAvY1dsa2FYcHBjV2xrYVdsNlFIRnBaR2w2YVdRdVkyOXQvMSIgc3R5bGU9ImRpc3BsYXk6bm9uZTsgd2lkdGg6MHB4OyBoZWlnaHQ6MHB4OyIgLz4=--B_ALT_4ebb74d5a5d64--发送动作完成