3

代码:

$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

邮件日志:

Mar 21 12:18:27 database sendmail[15156]: r2LCEFfB015154: to=<myaddress@whateveritis.com>, ctladdr=<apache@localhost.localdomain> (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=<myaddress@whateveritis.com>, ctladdr=<apache@localhost.localdomain> (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=<myaddress@whateveritis.com>, ctladdr=<apache@localhost.localdomain> (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=<201303211219.r2LCJcKD015229@localhost.localdomain>, relay=apache@localhost
Mar 21 12:19:39 database sendmail[15230]: r2LCJdfM015230: from=<apache@localhost.localdomain>, size=357, class=0, nrcpts=1, msgid=<201303211219.r2LCJcKD015229@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Mar 21 12:19:39 database sendmail[15229]: r2LCJcKD015229: to=myaddress@whateveritis.com, 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)
4

1 回答 1

1

您是否与您的托管公司核实过他们是否在服务器上实施了内部邮件系统?会捕获邮件并将其发送到本地而不让它离开服务器的东西吗?如果您检查您的目录,它通常是像 //Mail 或类似的文件夹。

于 2013-03-28T19:04:23.717 回答