我试图将本地计算机上的简单邮件发送到我的Gmail帐户。 Mail()始终返回TRUE但从不发送任何内容。
这是我正在运行的简单PHP代码
$header = "From: xyz@gmail.com\r\n";
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$header.= "X-Priority: 1\r\n";
if(mail("zyx@gmail.com", "This some subject", "This is some message body",$header))
echo "Sent";
else
echo "Not sent";
我现在正在使用postfix(在sendmail之前)。
这是/var/log/mail.log
Dec 30 09:50:14 localhost postfix / pickup [7452]:BB3E3861B90:uid = 33 from = www-data
Dec 30 09:50:14 localhost postfix / cleanup [7677]:BB3E3861B90:message-id =< 20151230142014.BB3E3861B90@daniel-Inspiron-N4050>
Dec 30 09:50:14 localhost postfix / qmgr [1542]:BB3E3861B90:from =,size = 476,nrcpt = 1(queue active)
Dec 30 09:50:14 localhost postfix / error [7679]:BB3E3861B90:to =,relay = none,delay = 0.28,延迟= 0.16 / 0/0 / 0.12,dsn = 5.0.0,status =退回(CITR $
Dec 30 09:50:14 localhost postfix / cleanup [7677]:EC875861B91:message-id =< 20151230142014.EC875861B91@daniel-Inspiron-N4050>
Dec 30 09:50:15 localhost postfix / bounce [7680]:BB3E3861B90:发件人未送达通知:EC875861B91
Dec 30 09:50:15 localhost postfix / qmgr [1542]:EC875861B91:from =<&gt ;, size = 2279,nrcpt = 1(queue active)
Dec 30 09:50:15 localhost postfix / qmgr [1542]:BB3E3861B90:已删除
Dec 30 09:50:15 localhost postfix / local [7683]:EC875861B91:to =,relay = local,delay = 0.15,delays = 0.07 / 0/0 / 0.08,dsn = 2.0.0,status = sent ($
Dec 30 09:50:15 localhost postfix / qmgr [1542]:EC875861B91:已删除
我也检查并且没有邮件队列。
我也尝试过这里公开的所有解决方案PHP mail form doesn't complete sending e-mail
谢谢!