Postfix 不發出 AUTH 指令

Postfix 不發出 AUTH 指令

我嘗試透過 Postfix 從我的伺服器發送電子郵件,但無法使其工作。我使用外部 SMTP 伺服器作為中繼主機。這是以下的相關部分/etc/postfix/main.cf

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
relayhost = [mail.myISP.nl]:submission
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all
smtp_generic_maps = hash:/etc/postfix/generic
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
debug_peer_list=mail.myISP.nl
debug_peer_level=5

我安裝了libsasl2-2libsasl2-modules並且sasl2-bin。在 中/etc/postfix/sasl_password,我輸入了有效的憑證:

[mail.myISP.nl]:587     myuserid:mypassword

之後我運行命令將文本文件轉換為文件.db

postmap /etc/postfix/sasl_password

並重新載入 Postfix 的配置:

sudo systemctl reload postfix

然而,實際上並沒有發送任何郵件。我使用以下命令運行了 TCP 轉儲:

echo "This is a test" | mail -s "Testing" [email protected]

結果是與遠端伺服器的以下交換:

(S) srv17610.myISP.nl ESMTP Exim 4.86.2 Wed, 28 Dec 2016 11:06:24 +0100
(C) EHLO hostname
(S) 250-srv17610.myISP.nl Hello my.canonical.name.nl [xxx.xxx.xxx.xxx]
(S) 250-SIZE 20971520
(S) 250-8BITMIME
(S) 250-PIPELINING
(S) 250-AUTH PLAIN LOGIN
(S) 250-STARTTLS
(S) 250 HELP
(C) MAIL FROM:<[email protected]> SIZE=310
(C) RCPT TO:<[email protected]>
(C) DATA
(S) 250 OK
(S) 550 relay not permitted, authentication required
(S) 503-All RCPT commands were rejected with this error:
(S) 503-relay not permitted, authentication required
(S) 503 Valid RCPT command must precede DATA
(C) RSET
(C) QUIT
(S) 250 Reset OK
(S) 221 srv17610.myISP.nl closing 

(C) 是 Postfix,(S) 是遠端伺服器。您可以看到它沒有發出 AUTH 命令,也沒有提供憑證,因此郵件被拒絕。簡單/var/log/mail.log地說郵件已發送。出了什麼問題?

答案1

您的配置看起來合法,但 postfix 要求它的 smtp_sasl_password_maps 檔案實際上以優化的方式存儲,而不是明文。

如果你沒有這樣的文件

運行命令:

郵政地圖 /etc/postfix/sasl_password

將會產生一個 sasl_password.db

服務後綴重新加載

應用程式變更

相關內容