Home >Backend Development >PHP Tutorial >求助phpmailer类应用
<?phprequire("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();?>
是不是当成垃圾邮件了?
error_reporting(E_ALL); //行首加上这句看看
是不是当成垃圾邮件了?
error_reporting(E_ALL); //行首加上这句看看
垃圾邮件也木有- -我已经翻来覆去找了好多遍。。。
在$mail->host = "";上加一句$mail->IsSMTP();
在$mail->host = "";上加一句$mail->IsSMTP();
- -谢谢。。了。。之前写的时候不知道为什么删掉了。。。