Home  >  Article  >  Backend Development  >  求助phpmailer类应用

求助phpmailer类应用

WBOY
WBOYOriginal
2016-06-23 14:05:21861browse

<?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();
- -谢谢。。了。。之前写的时候不知道为什么删掉了。。。

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