求助phpmailer类应用
<?php<br />require("class.phpmailer.php");<br /> function sendEmail($from = '[email protected]',$who ='Michaelssss',$To = '[email protected]',$body = 'BBB')<br /> {<br /> $mail = new PHPMailer;<br /> $mail->Host = "smtp.163.com";<br /> $mail->Port = 25;<br /> $mail->SMTPAuth = true;<br /> $mail->SMTPDebug = 1;<br /> <br /> $mail->Username = '[email protected]';<br /> $mail->Password = 'xxxxxxx';<br /> <br /> $mail->From = $from;<br /> $mail->FromName = $who;<br /> <br /> $mail->AddAddress($To,$who);<br /> $mail->WordWrap = 50;<br /> <br /> $mail->IsHTML(true);<br /> <br /> $mail->Subject = 'TEST';<strong>2本文来源gaodaima#com搞(代@码$网6</strong><pre>搞gaodaima代码
$mail->Body = $body;
if(!$mail->Send())
{
echo $mail->ErrorInfo;
exit;
}
else
echo ‘Ok’;
}
sendEmail();
?>
– -不知道哪位大虾能告诉我,为什么我发不出去。。。本地没有报错。。。但是测试邮箱就是没收到。。。简直泪奔了。。。
——解决方案——————–
是不是当成垃圾邮件了?
error_reporting(E_ALL); //行首加上这句看看
——解决方案——————–
在$mail->host = “”;上加一句$mail->IsSMTP();