Php PEAR邮件未发送但也未报告错误

Php PEAR邮件未发送但也未报告错误,php,email,pear,Php,Email,Pear,我尝试使用PEAR Mail通过PHP发送电子邮件,但尽管页面报告邮件已发送,但它从未到达(我将其发送给自己进行测试) 我一直在研究如何处理错误,如果我启用严格报告,我会收到大约六份以下报告: Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in Blah Blah Blah! on line

我尝试使用PEAR Mail通过PHP发送电子邮件,但尽管页面报告邮件已发送,但它从未到达(我将其发送给自己进行测试)

我一直在研究如何处理错误,如果我启用严格报告,我会收到大约六份以下报告:

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in Blah Blah Blah! on line 450

Strict Standards: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in Blah Blah Blah! on line 451
在我的阅读中,我被告知这些错误并没有阻止脚本的成功,大多数人只是放弃了严格的报告,但是在我的情况下,脚本不起作用

我尝试了以下方法来捕获错误

try {
$host = "ssl://mail.example.com";  
$port = 25;
$auth = true; // turn on SMTP authentication  
$username = "name@example.com"; // SMTP username  
$password = "password"; // SMTP password 

$mail = Mail::factory('smtp', 
        array('host'=>$host,'port'=>$port,'auth'=>true,'username'=>$username,'password'=>$password));
$mail->send($to,$headers,$message);
} catch (Exception $e) {
echo "Exception: " . $e->getMessage();
}
echo "Message Successfully Sent!";
而且也没有尝试捕捉和简单地使用

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
if(PEAR::isError($mail)){
echo(“”$mail->getMessage()”

”; }否则{ echo(消息已成功发送!

); }
在这两种情况下,页面都会报告“电子邮件已成功发送!”,但邮件不会到达。如果我故意输入错误的用户和密码或虚构的邮件服务器,则不会报告任何错误

在这种情况下,我如何检查错误?如果我给它一个明显的错误,为什么脚本仍然会运行

谢谢 格雷格

达贡

谢谢你给我指明了正确的方向。在进一步搜索后,我找到了如何设置$params['debug'],这就找到了问题的根源

因此,对于那些努力找到调试邮件发送尝试的方法的人来说,答案是

$params = array('debug'=>true,'host'=>$host,'port'=>$port,'auth'=>true,'username'=>$username,'password'=>$password);
$mail = Mail::factory('smtp', $params);
$mail->send($to,$headers,$message);

这将显示邮件连接响应以及发送到邮件服务器进行调试的所有内容。

邮件日志是怎么说的?您是指邮件服务器的错误日志还是其他内容?我无权访问邮件服务器日志。