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