Sendmail

Sendmail 通過 LMTP 發送空白收件人

  • November 3, 2011

標題幾乎概括了。本地郵件通過 LMTP 執行良好,但非本地郵件(虛擬主機)正在苦苦掙扎。我在下面提供了盡可能多的資訊,試圖保持相關性。我無法弄清楚這裡出了什麼問題。

我已經驗證的事情:

  • example.com{VirtHost}
  • 它試圖通過我的郵件發送,而不是local(雖然local也發送到 LMTP,並且執行良好)。通過日誌驗證並僅更改虛擬郵件的 LMTP 套接字(見下文)。

郵件規範:

Mdovecot, P=[IPC], F=SXmnz9,
   S=EnvFromSMTP/HdrFromL, R=EnvToSMTP/HdrToL, E=\r\n,
   T=DNS/RFC822/SMTP,
   A=FILE /var/run/dovecot/lmtp

SMTP 對話:

$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.example.com ESMTP Sendmail; Mon, 31 Oct 2011 23:29:54 GMT
EHLO localhost
MAIL FROM: root@example.com
RCPT TO: mscharley@example.com
DATA
To: mscharley@example.com
From: root@example.com
Subject: Hello world!

Hello there, everyone!
.
quit
250-mail.example.com Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
250 2.1.0 root@example.com... Sender ok
250 2.1.5 mscharley@example.com... Recipient ok
354 Enter mail, end with "." on a line by itself
250 2.0.0 p9VNTswi016356 Message accepted for delivery
221 2.0.0 mail.example.com closing connection
Connection closed by foreign host.

生成的 LMTP 對話:

# socat -v UNIX-LISTEN:lmtp-socat UNIX-CLIENT:lmtp
< 220 mail.example.com Dovecot LMTP ready\r
> LHLO mail.example.com\r
< 250-mail.example.com\r
< 250-8BITMIME\r
< 250-ENHANCEDSTATUSCODES\r
< 250 PIPELINING\r
> MAIL From:<root@example.com>\r
< 250 2.1.0 OK\r
> RCPT To:<>\r
> DATA\r
< 550 5.1.1 <> User doesn't exist: \r
< 554 5.5.1 No valid recipients\r
> RSET\r
< 250 2.0.0 OK\r
> QUIT\r
< 221 2.0.0 Client quit\r

Sendmail地址翻譯(我認為這是內部處理的工作方式,如果不是,請有人糾正我,我會解決這個問題):

$ sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 0,3,EnvToSMTP mscharley@example.com
parse              input: mscharley @ example . com
Parse0             input: mscharley @ example . com
Parse0           returns: mscharley @ example . com
ParseLocal         input: mscharley @ example . com
ParseLocal       returns: mscharley @ example . com
Parse1             input: mscharley @ example . com
Parse1           returns: $# local $: mscharley @ example . com
parse            returns: $# local $: mscharley @ example . com
canonify           input: $# local $: mscharley @ example . com
canonify         returns: $# local $: mscharley @ example . com
EnvToSMTP          input: $# local $: mscharley @ example . com
EnvToSMTP        returns: $# local $: mscharley @ example . com

有時你只需要把所有的東西都打出來來理順你自己的想法。

這是由 中的空白域引起的mailertable,即:

example.com    dovecot:

將其更改為以下內容完全解決了該問題:

example.com    dovecot:example.com

引用自:https://serverfault.com/questions/326522