作为这个问题,我做了一些研究,发现SuperUser 上的这个答案这似乎解决了 sendmail 无法写入特定文件的问题。具体来说,停止 sendmail、检查正在进行的进程、终止它们,然后重新启动 sendmail 解决了我的问题的这一部分。
作为测试,我尝试从命令行向自己发送另一封电子邮件:。电子邮件发送不正确,但我echo "Subject: sendmail test" | sudo sendmail /usr/sbin/sendmail -v [email protected]
做过从 sendmail 本身收到一封退回的电子邮件,其中包含以下错误:
From MAILER-DAEMON Tue Jul 23 12:44:30 2019
Return-Path: <MAILER-DAEMON>
Received: from major-productions.com (localhost [127.0.0.1])
by major-productions.com (8.15.2/8.15.2/Debian-12) with ESMTP id x6NGiUQO012820
for <[email protected]>; Tue, 23 Jul 2019 12:44:30 -0400
Received: from localhost (localhost)
by major-productions.com (8.15.2/8.15.2/Submit) id x6NGiUSL012819;
Tue, 23 Jul 2019 12:44:30 -0400
Date: Tue, 23 Jul 2019 12:44:30 -0400
From: Mail Delivery Subsystem <MAILER-DAEMON@debian>
Message-Id: <[email protected]>
To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="x6NGiUSL012819.1563900270/major-productions.com"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
This is a MIME-encapsulated message
--x6NGiUSL012819.1563900270/major-productions.com
The original message was received at Tue, 23 Jul 2019 12:44:30 -0400
from root@localhost
----- The following addresses had permanent fatal errors -----
/usr/sbin/sendmail
(reason: 550 5.7.1 </usr/sbin/[email protected]>... Cannot mail directly to files)
(expanded from: /usr/sbin/sendmail)
-v
(reason: 550 5.1.1 <[email protected]>... User unknown)
(expanded from: -v)
----- Transcript of session follows -----
... while talking to [127.0.0.1]:
>>> DATA
<<< 550 5.1.1 <[email protected]>... User unknown
550 5.1.1 -v... User unknown
<<< 550 5.7.1 </usr/sbin/[email protected]>... Cannot mail directly to files
550 5.1.1 /usr/sbin/sendmail... User unknown
--x6NGiUSL012819.1563900270/major-productions.com
Content-Type: message/delivery-status
Reporting-MTA: dns; major-productions.com
Arrival-Date: Tue, 23 Jul 2019 12:44:30 -0400
Final-Recipient: RFC822; /usr/sbin/[email protected]
Action: failed
Status: 5.7.1
Remote-MTA: DNS; [127.0.0.1]
Diagnostic-Code: SMTP; 550 5.7.1 </usr/sbin/[email protected]>... Cannot mail directly to files
Last-Attempt-Date: Tue, 23 Jul 2019 12:44:30 -0400
Final-Recipient: RFC822; [email protected]
Action: failed
Status: 5.1.1
Remote-MTA: DNS; [127.0.0.1]
Diagnostic-Code: SMTP; 550 5.1.1 <[email protected]>... User unknown
Last-Attempt-Date: Tue, 23 Jul 2019 12:44:30 -0400
--x6NGiUSL012819.1563900270/major-productions.com
Content-Type: message/rfc822
Return-Path: <me>
Received: (from root@localhost)
by major-productions.com (8.15.2/8.15.2/Submit) id x6NGiUSK012819;
Tue, 23 Jul 2019 12:44:30 -0400
Date: Tue, 23 Jul 2019 12:44:30 -0400
From: Dude Guy <me>
Message-Id: <[email protected]>
Subject: sendmail test
--x6NGiUSL012819.1563900270/major-productions.com--
我猜这是一个配置错误,但不知道在哪里查看/更改什么。
答案1
您调用了 sendmail,但告诉它您想将邮件发送到/usr/sbin/sendmail
,然后-v
,然后[email protected]
。似乎只有最后一封电子邮件发送成功;其他两封显然被退回了。
不清楚你为什么这样写命令行,但我猜这只是一个错误。你应该写或类似的东西。sendmail -v [email protected]