在 ubuntu 系统上,我安装了 postfix 并在 /etc/postfix/main.cf 配置文件中设置了 replyhost 和 mynetworks。
我现在可以远程登录到此服务器上的端口 25,并通过发出 SMTP 命令发送电子邮件。我对 gmail 帐户进行了测试,并成功收到了电子邮件消息。
但是在同一个 Linux 主机上我安装了邮件(apt-get mailutils)并运行了以下命令:
mail -s "test email" myname@gmailcom
输入了一些消息文本并按 Ctrl-D,没有看到任何错误,但收件人从未收到消息。
我是否必须以某种方式在邮件配置中配置 smtp 服务器?我是否应该看到邮件处于某种队列中等待发送?
有什么解决方法吗?
更多信息:
我的 /etc/mailname 配置文件包含字符串:mail.mydomain.com,而我的 Linux 机器未配置域(它只是一个测试系统)。我应该将其更改为仅 mail 吗?(mail 是机器的主机名)。
我发现了一种允许您指定发件人的邮件语法,它对我有用:
mail -s "message 5" -a "From: [email protected]" [email protected]
但我更愿意修复,所以我不需要这么做。
这是我通过交互方式使用邮件看到的错误:
Return-Path: <>
X-Original-To: johnny@mail
Delivered-To: johnny@mail
Received: by mydomain.com (Postfix)
id BC328647FF; Sun, 6 Jul 2014 18:04:51 +0100 (BST)
Date: Sun, 6 Jul 2014 18:04:51 +0100 (BST)
From: [email protected] (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: johnny@mail
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="3EEA5647FE.1404666291/mydomain.com"
Message-Id: <[email protected]>
This is a MIME-encapsulated message.
--3EEA5647FE.1404666291/mydomain.com
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii
This is the mail system at host mydomain.com.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<[email protected]>: host post.demon.co.uk[91.221.168.151] said: 504 5.5.2
<johnny@mail>: Sender address rejected: need fully-qualified address (in
reply to RCPT TO command)
--3EEA5647FE.1404666291/mydomain.com
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; mydomain.com
X-Postfix-Queue-ID: 3EEA5647FE
X-Postfix-Sender: rfc822; johnny@mail
Arrival-Date: Sun, 6 Jul 2014 18:04:46 +0100 (BST)
Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.5.2
Remote-MTA: dns; post.demon.co.uk
Diagnostic-Code: smtp; 504 5.5.2 <johnny@mail>: Sender address rejected: need
fully-qualified address
--3EEA5647FE.1404666291/mydomain.com
Content-Description: Undelivered Message
Content-Type: message/rfc822
Return-Path: <johnny@mail>
Received: by mydomain.com (Postfix, from userid 1000)
id 3EEA5647FE; Sun, 6 Jul 2014 18:04:46 +0100 (BST)
Subject: msg 10
To: <[email protected]>
X-Mailer: mail (GNU Mailutils 2.99.98)
Message-Id: <[email protected]>
Date: Sun, 6 Jul 2014 18:04:46 +0100 (BST)
From: johnny@mail (John Hammond)
test message
--3EEA5647FE.1404666291/mydomain.com--
答案1
要查看邮件是否可能位于队列中,请mailq
在命令行上使用,或检查/var/spool/mail
目录的内容。Postfix 也应该记录到- 您可以打开另一个 shell 会话,并在其他 shell 会话中/var/log/maillog
运行时跟踪此文件- 使用mail
tail -f /var/log/maillog