postfix 命令=5 导致邮件无法发送

postfix 命令=5 导致邮件无法发送

我只能使用 postfix 发送邮件,但是当要向我自己的域发送邮件时,postfix 通常使用命令 = 6 来发送电子邮件,但有时它会发出命令=5这导致邮件失败而且我不知道它们最终到了哪里。

以下转储中导致错误的行 -

disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
20FB641206: from=<[email protected]>, size=3149, nrcpt=1 (queue active)

来自 postfix 的转储

Aug 10 07:29:49 ubuntu postfix/smtpd[1669634]: connect from localhost[127.0.0.1]
Aug 10 07:29:49 ubuntu postfix/smtpd[1669634]: 20FB641206: client=localhost[127.0.0.1]
Aug 10 07:29:49 ubuntu postfix/cleanup[1669637]: 20FB641206: message-id=<632614904.2235.1691652589133@ubuntu>
Aug 10 07:29:49 ubuntu postfix/smtpd[1669634]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Aug 10 07:29:49 ubuntu postfix/qmgr[533470]: 20FB641206: from=<[email protected]>, size=3149, nrcpt=1 (queue active)
Aug 10 07:29:49 ubuntu postfix/smtp[1669638]: 20FB641206: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[142.251.167.27]:25, delay=0.54, d
elays=0/0/0.23/0.31, dsn=2.0.0, status=sent (250 2.0.0 OK  1691652589 d7-20020a0cb2c7000000b0063d456fcd44si447714qvf.515 - gsmtp)
Aug 10 07:29:49 ubuntu postfix/qmgr[533470]: 20FB641206: removed

Postfix 主要使用命令=6,这会导致发送的邮件 -

Aug 10 07:29:44 ubuntu postfix/smtpd[1669634]: connect from localhost[127.0.0.1]
Aug 10 07:29:44 ubuntu postfix/smtpd[1669634]: 1B16341206: client=localhost[127.0.0.1]
Aug 10 07:29:44 ubuntu postfix/cleanup[1669637]: 1B16341206: message-id=<835472293.2234.1691652584108@ubuntu>
Aug 10 07:29:44 ubuntu postfix/smtpd[1669634]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=2 data=1 quit=1 commands=6
Aug 10 07:29:44 ubuntu postfix/qmgr[533470]: 1B16341206: from=<[email protected]>, size=1043, nrcpt=2 (queue active)
Aug 10 07:29:44 ubuntu postfix/smtp[1669638]: 1B16341206: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[142.251.167.27]:25, delay=0.6, del
ays=0.01/0/0.23/0.36, dsn=2.0.0, status=sent (250 2.0.0 OK  1691652584 o5-20020a05620a0d4500b00767507d715asi489272qkl.541 - gsmtp)
Aug 10 07:29:46 ubuntu postfix/smtp[1669639]: 1B16341206: to=<[email protected]>, relay=route1.mx.cloudflare.net[2606:4700:f5::c]:25, delay=2.6, delays=0.01
/0/0.19/2.4, dsn=2.0.0, status=sent (250 2.0.0 Ok)
Aug 10 07:29:46 ubuntu postfix/qmgr[533470]: 1B16341206: removed

/etc/postfix/main.cf 文件 -

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2



# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ubuntu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, smtp.domain.com, ubuntu, localhost.localdomain, localhost
relayhost =
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

我的错,我只发送了一些电子邮件,在这种情况下它显示命令=5

如果电子邮件已发送并抄送给[电子邮件保护]它显示命令=6

答案1

commands=N不是错误消息,直接指示成功或失败;它只是为了让您了解在 SMTP 交换期间客户端发出了 N 个命令,以便您大致了解对话花费了多长时间。

典型的 SMTP 对话如下所示:

(connection established)
(server) 220 server.host.nam.me ESMTP blah-blah blah ...
(client) HELO [or EHLO] client.host.na.me
(server) 250-...
         250-...
         250 (proceed)
(client) MAIL FROM: [envelope sender email address]
(server) 250 (proceed)
(client) RCPT TO: [envelope recipient email address]
(server) 250 (proceed)
(client) DATA
(server) 250 (proceed end message with CRLF | "." | CRLF)
(client) message headers and data
(client) .
(server) 250 QUEUED as [some name]
(client) QUIT
(server) 221 Goodbye!
(connection terminated)

如果您计算客户端执行某项操作的次数,您会发现有 5 次:HELO、、和。这些是命令,如您所见,通常需要 5 个命令才能发送一封邮件。在某些情况下可能会更多:客户端可能进行身份验证,或者有多个命令(为此邮件添加更多收件人),或其他情况。我相信这是您的情况:额外的收件人导致发出额外的命令。MAIL FROMRCPT TODATAQUITRCPT TOadmin@...RCPT TO

此外,在某些情况下,服务器或客户端可能会提前中断对话。例如,如果服务器不想转发具有特定信封发件人地址的邮件,则在收到后可能会指示错误而不是 250(接受)回复代码MAIL FROM,而客户端可能会QUIT对此进行回复,从而导致对话需要少于 5 个命令。因此,如果您在那里看到小于 5 的数字,则可能是失败的迹象(但不总是)。

唯一的确定的消息传递状态的指示是status=日志行后面的单词:

Aug 10 07:29:46 ubuntu postfix/smtp[1669639]: 1B16341206: to=<[email protected]>, relay=route1.mx.cloudflare.net[2606:4700:f5::c]:25, delay=2.6, delays=0.01/0/0.19/2.4, dsn=2.0.0, status=sent (250 2.0.0 Ok)

这封邮件是sent,实际上意味着,在 SMTP 对话期间route1.mx.cloudflare.net,服务器在 DATA 命令的最后一个点之后回复了250 (ok) ...。这里可能还有其他状态,这意味着它们相应的状态,这是 Postfix 指示传递问题的方式。

相关内容