Home > Backend Development > PHP Tutorial > php PHPMailer 报错?

php PHPMailer 报错?

WBOY
Release: 2016-06-23 13:47:34
Original
1109 people have browsed it

<?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 " 邮件发送成功";?>
Copy after login

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 包吧!里面什么都很齐全,自己改变些内容,然后记得开通邮件端口

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template