Home >Backend Development >PHP Tutorial >php PHPMailer 出错

php PHPMailer 出错

WBOY
WBOYOriginal
2016-06-13 12:07:581327browse

php PHPMailer 报错?

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

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="[email protected]";//邮箱用户名
改成
$mail->Username="[email protected]";//邮箱用户名

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

Statement:
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