我的主機使用SquirrelMail的SquirrelMail,我可以發送郵件,除此之外我也可以收到郵件。 拿着簡單的代碼來測試:php郵件不工作
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers)){
echo '1';
}else echo '2';
phpinfo()函數
SMTP localhost
smtp_port 25
sendmail_from no value | no value
sendmail_path /usr/sbin/sendmail -t -i -f **MAIL** | /usr/sbin/sendmail -t -i
where **MAIL** is my personal mail, not the one, I want to send from
但隨着我的劇本我不能發送電子郵件。接收2. wtf?
您是否收到任何錯誤?它是否回顯「1」或「2」? – juco 2013-02-22 09:27:49
當我嘗試發送它 - 接收2 – mozg 2013-02-22 09:28:34
你在網絡服務器上運行它嗎? – 2013-02-22 09:28:37