Home  >  Article  >  Backend Development  >  phpmailer类应用

phpmailer类应用

WBOY
WBOYOriginal
2016-06-13 12:48:40754browse

求助phpmailer类应用

<?php<br />
require("class.phpmailer.php");<br />
	function sendEmail($from = '3855122@163.com',$who ='Michaelssss',$To = '123456@qq.com',$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 = '3855122@163.com';<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';<br />
		$mail->Body = $body;<br />
		if(!$mail->Send())<br />
		{<br />
			echo $mail->ErrorInfo;<br />
			exit;<br />
		}<br />
		else<br />
		echo 'Ok';<br />
	}<br />
	sendEmail();<br />
?><br />

- -不知道哪位大虾能告诉我,为什么我发不出去。。。本地没有报错。。。但是测试邮箱就是没收到。。。简直泪奔了。。。


------解决方案--------------------
是不是当成垃圾邮件了?
error_reporting(E_ALL); //行首加上这句看看
------解决方案--------------------
在$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