CODE:以上发送内部电子邮件
$from = $_GET['from'];
$to = $_GET['to'];
$headers = "From:" . $from;
mail($to, 'PHP mail() function', 'Coming from PHP mail() function', $headers);
echo 'Check your inbox for PHP mail() function';
代码用来发送电子邮件本地,但不再工作。只适用于发送外部电子邮件。另外,swift_emailer()也不起作用。
更多细节:
坐落在:
/usr/sbin/sendmail
phpinfo()函数输出:
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
MAIL LOG:
Mar 21 12:18:27 database sendmail[15156]: r2LCEFfB015154: to=<[email protected]>, ctladdr=<[email protected]> (48/48), delay=00:04:12, xdelay=00:04:12, mailer=esmtp, pri=120357, relay=mx00.1and1.co.uk. [212.227.15.134], dsn=5.0.0, stat=Service unavailable
Mar 21 12:18:27 database sendmail[15156]: r2LCEFfB015154: r2LCIRfB015156: DSN: Service unavailable
Mar 21 12:18:27 database sendmail[15156]: r2LCIRfB015156: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31619, dsn=2.0.0, stat=Sent
Mar 21 12:18:32 database sendmail[15162]: r2LCENGr015160: to=<[email protected]>, ctladdr=<[email protected]> (48/48), delay=00:04:09, xdelay=00:04:08, mailer=esmtp, pri=120356, relay=mx01.1and1.co.uk. [212.227.17.175], dsn=5.0.0, stat=Service unavailable
Mar 21 12:18:32 database sendmail[15162]: r2LCENGr015160: r2LCIWGr015162: DSN: Service unavailable
Mar 21 12:18:32 database sendmail[15162]: r2LCIWGr015162: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31618, dsn=2.0.0, stat=Sent
Mar 21 12:18:50 database sendmail[15166]: r2LCEk12015164: to=<[email protected]>, ctladdr=<[email protected]> (48/48), delay=00:04:04, xdelay=00:04:04, mailer=esmtp, pri=120357, relay=mx01.1and1.co.uk. [212.227.15.134], dsn=5.0.0, stat=Service unavailable
Mar 21 12:18:50 database sendmail[15166]: r2LCEk12015164: r2LCIo12015166: DSN: Service unavailable
Mar 21 12:18:50 database sendmail[15166]: r2LCIo12015166: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31619, dsn=2.0.0, stat=Sent
Mar 21 12:19:39 database sendmail[15229]: r2LCJcKD015229: from=apache, size=123, class=0, nrcpts=1, msgid=<[email protected]>, [email protected]
Mar 21 12:19:39 database sendmail[15230]: r2LCJdfM015230: from=<[email protected]>, size=357, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Mar 21 12:19:39 database sendmail[15229]: r2LCJcKD015229: [email protected], ctladdr=apache (48/48), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30123, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (r2LCJdfM015230 Message accepted for delivery)
当你尝试时会发生什么?信息消失了吗?你是否收到来自邮件服务器的退回邮件?有没有错误?你的HTTP服务器日志说什么?你的sendmail日志说什么? – Quentin 2013-03-21 12:11:56
出于好奇,如果您将'$ from'更改为外部电子邮件地址,它会起作用吗?你检查过SPAM文件夹吗? – jnthnjns 2013-03-21 12:12:39
@Quentin - 没有错误,没有布鲁斯,日志添加上面。 – BentCoder 2013-03-21 12:26:26