我想通过外部邮件服务器从我的服务器发送电子邮件。 所以我安装了nullmailer
作为Debian 7 x32中最简单的MTA之一。
我的/etc/nullmailer/remotes
:
smtp.example.com smtp [email protected] --pass=*** --port 465 --ssl
这种情况下的用户是远程服务器上的注册用户。
现在我想发送testing邮件。 Nullmailerreplacesendmail有几个参数:
用法:sendmail [flags] [recipients]
-f设置信封发件人地址
好的,所以我发邮件给:
ls | sendmail -f [email protected] [email protected]
但是,这个邮件来到[email protected]邮箱。 其中一个标题说:
致:未公开收件人:;
据我所知,nullmailer不发送收件人地址。
好的,现在我尝试通过php
发送它:
mail("[email protected]","subject","message","From: [email protected]");
但事实上没有任何发送。 日志说:
smtp:失败:553 5.7.1发件人地址被拒绝:不属于auth用户。 发送失败:发送消息时出现永久性错误
嗯…看起来很奇怪 如果我列出nullmailer队列我看到
sendmail -bp 2015-03-23 14:58:26 332 bytes from <[email protected]> to <[email protected]>
我不知道这个[email protected]
是从哪里来的。 所以现在队列被冻结了。 我在/var/spool/nullmailer/queue/
find了这个队列。 每个电子邮件保存为带有标题和邮件正文的文件。 一个文件看起来像:
[email protected] [email protected] Received: (nullmailer pid 14630 invoked by uid 0); Mon, 23 Mar 2015 04:58:26 -0000 To: [email protected] Subject: subject X-PHP-Originating-Script: 0:test.php From: [email protected] Date: Mon, 23 Mar 2015 14:58:26 +1000 Message-Id: [email protected]> message
所以我改变了标题
[email protected] [email protected]
至
[email protected] [email protected]
瞧! – 电子邮件按预期发送 – 从[email protected]
发送到[email protected]
所以我的问题 – 我做错了什么,如何以正常的方式发送电子邮件与nullmailer
?