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