为了试图从php脚本发送邮件,我正在用此代码测试邮件()函数 :
<?php
ini_set("display_errors", "1");
error_reporting(E_ALL);
$to = [email protected] ;
$message = test ;
$from = [email protected] ;
$subject = Test ;
$headers = "From: $from
";
mail($to, $subject, $message, $headers) or die ("Message not sent");
?>
This is not the only code I have tried it with, but nothing seems to be working. One of the reasons I am inquiring here is because it returns no errors whatsoever. I get no indication of any error at all, except that the mail never reaches it s destination. Things that I have done to try and fix the problem:
- Changed the SMTP in php.ini from localhost to gmail s smtp
- Checked spam filters and outboxes on both ends
- Tried various methods of error reporting
- Tried several different functions for sending mail
- Checked seemingly related things in phpinfo() and looked them up to no avail
我认为这也许与我的终端的发送邮件功能有问题, 但我无法测试或修正任何与发送邮件功能有关的问题。
我正用OS X 10.4 老虎和PHP 5.