![Sendmail 无法找到收件人来发送电子邮件](https://linux22.com/image/787346/Sendmail%20%E6%97%A0%E6%B3%95%E6%89%BE%E5%88%B0%E6%94%B6%E4%BB%B6%E4%BA%BA%E6%9D%A5%E5%8F%91%E9%80%81%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6.png)
我正在尝试为我的服务器设置 sendmail 以发送警报通知状态。在互联网上搜索指南后,我仍然无法向我的工作电子邮件发送外发电子邮件。据我所知,sendmail 不需要任何配置即可发送电子邮件。我检查了外发端口 25、配置了 DNS 并编辑了主机名,但没有成功。这是我收到的失败电子邮件响应。据我所知,它找不到电子邮件的收件人。我还需要更改什么才能使其成功?
From: Mail Delivery Subsystem <[email protected]>
Message-Id: <[email protected]>
To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="3651ovxS001207.1688521876/company.com"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
This is a MIME-encapsulated message
--3651ovxS001207.1688521876/company.com
The original message was received at Wed, 5 Jul 2023 01:50:57 GMT
from root@localhost
----- The following addresses had permanent fatal errors -----
[email protected]
(reason: 550 5.1.1 <[email protected]>... User unknown)
(expanded from: [email protected])
----- Transcript of session follows -----
... while talking to [127.0.0.1]:
>>> DATA
<<< 550 5.1.1 <[email protected]>... User unknown
550 5.1.1 [email protected]... User unknown
<<< 503 5.0.0 Need RCPT (recipient)
--3651ovxS001207.1688521876/company.com
Content-Type: message/delivery-status
Reporting-MTA: dns; company.com
Arrival-Date: Wed, 5 Jul 2023 01:50:57 GMT
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: Wed, 5 Jul 2023 01:51:16 GMT
--3651ovxS001207.1688521876/company.com
Content-Type: message/rfc822
Return-Path: <root>
Received: (from root@localhost)
by company.com (8.15.2/8.15.2/Submit) id 3651ovxR001207
for [email protected]; Wed, 5 Jul 2023 01:50:57 GMT
Date: Wed, 5 Jul 2023 01:50:57 GMT
From: root <root>
Message-Id: <[email protected]>
Subject: Test email
Test email from linode
--3651ovxS001207.1688521876/company.com--
答案1
- 检查收件人的域 (
company.com
) 是否配置为本地电子邮件域(sendmail 发送到本地邮箱的域)。
要以 root 身份从 sendmail 获取本地电子邮件域列表,请执行:
echo '$=w' | sendmail -bt
- 不是 =>以 root 身份发送带有 SMTP 会话完整记录的测试消息。这通常有助于减少可能出现的问题。
以详细模式发送测试消息的 Shell 脚本示例:
#!/bin/sh
RECIPIENT='[email protected]'
/usr/sbin/sendmail -v -oi -- $RECIPIENT <<END
To: [email protected]
Subject: Delivery test
Delivery test
END
答案2
当您的服务器出现问题时,首先要查看的是您的日志。
原因:550 5.1.1[电子邮件保护]... 用户未知
这里有两种可能的情况(哪种情况适用已在您的日志中回答):
您的 MTA 连接到了正确的位置,但另一端的服务器拒绝了该电子邮件。您无法修复此问题。
您的 MTA 连接到了错误的位置。为什么会发生这种情况以及如何修复......我们不知道 - 您没有提供任何配置详细信息。