Heim  >  Artikel  >  Backend-Entwicklung  >  phpmailer类应用

phpmailer类应用

WBOY
WBOYOriginal
2016-06-13 12:48:40751Durchsuche

求助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();
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn