求助phpmailer类应用
<?php
require("class.phpmailer.php");
function sendEmail($from = '3855122@163.com',$who ='Michaelssss',$To = '123456@qq.com',$body = 'BBB')
{
$mail = new PHPMailer;
$mail->Host = "smtp.163.com";
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->SMTPDebug = 1;
$mail->Username = '3855122@163.com';
$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();
?>