Heim  >  Artikel  >  Backend-Entwicklung  >  php PHPMailer 报错?

php PHPMailer 报错?

WBOY
WBOYOriginal
2016-06-23 13:47:341038Durchsuche

<?phprequire("class.phpmailer.php");$mail=new PHPMailer();//$mail->Charset="UTF-8";$address="2069667008@qq.com";$mail->IsSMTP();//使用smtp方式发送$mail->Host="smtp.163.com";//你的企业邮域名$mail->SMTPAuth=true;//启用smtp验证功能$mall->Username="xxx@163.com";//邮箱用户名$mail->Password="xxx";$mail->Port=25;$mail->From="aaa@sohu.com";$mail->AddAddress("$address","a");$mail->Subject="发的标题";$mail->Body="内容 hello,world";if(!$mail->Send()){	echo "邮件发送失败 <p>";	echo "错误原因".$mail-ErrorInof;	exit;		}echo " 邮件发送成功";?>

Warning: Creating default object from empty value in D:\apache2.4.10VC9\Apache24\htdocs\PHPMailer\test.php on line 10
邮件发送失败

Catchable fatal error: Object of class PHPMailer could not be converted to string in D:\apache2.4.10VC9\Apache24\htdocs\PHPMailer\test.php on line 21
这是哪里错了
版本:PHPMailer_5.2.4  php版本是php-5.4.32


回复讨论(解决方案)

echo "错误原因".$mail-ErrorInof;
改成
echo "Mailer Error: " .  $mail->ErrorInfo;

$mall->Username="xxx@163.com";//邮箱用户名
改成
$mail->Username="xxx@163.com";//邮箱用户名

$mail->SMTPDebug提示出错
SMTP -> ERROR: RCPT not accepted from server: 553 5.7.1 : Sender address rejected: not owned by user tomcat_boy@sohu.com

去下载个PHPMailer 包吧!里面什么都很齐全,自己改变些内容,然后记得开通邮件端口

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn