PHPMailer不提供错误信息 [英] PHPMailer does not provide ErrorInfo

查看:8
本文介绍了PHPMailer不提供错误信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对PHP Mailer有一个问题,当出现错误时,它没有提供$mail->ErrorInfo。 我使用[http://phpmailer.worxware.com/?pg=tutorial#1]中的原始示例进行了测试,如下所示。

<?php

require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();  // telling the class to use SMTP
$mail->Host     = "smtp.example.com"; // SMTP server

$mail->From     = "from@example.com";

$mail->Subject  = "First PHPMailer Message";
$mail->Body     = "Hi! 

 This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;

if(!$mail->Send()) {
   echo 'Message was not sent.';
   echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
  echo 'Message has been sent.';
}
?>

我已经将主机设置为我的服务器,修改了"From"和"Address"以更正地址,并且我如期收到了测试邮件。但是,当我将收件人地址更改为blxxxa@blablaxxxx.de时,只是为了检查如何处理错误,我没有收到错误。

$mail->AddAddress("blxxxa@blablaxxxx.de");

我仍然收到"消息已发送"。有什么想法吗?可能是服务器设置?

推荐答案

ErrorInfo除非发生错误,否则不会包含错误消息。听起来您的邮件服务器正在毫无怨言地接受邮件(如果它是中继或在本地主机上,这是预期的),因此您需要检查邮件服务器日志和退回邮箱,因为问题在您的上游,因此PHPMailer看不到。

简而言之,你没有做错什么,只是看错了地方。

这篇关于PHPMailer不提供错误信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆