Home >Backend Development >PHP Tutorial >PHPMailer 出错 Could not instantiate mail function

PHPMailer 出错 Could not instantiate mail function

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:51:171551browse

PHPMailer 报错 Could not instantiate mail function.
我在phpmailer官网下载的最新的库,根据里面自带的test下的测试文件配置的,php.ini里面也支持sockets。上网查了许多资料也都试了还是不行,故在此请教各位大神指点指点,不胜感激!!!

<?php<br />/**<br />* Simple example script using PHPMailer with exceptions enabled<br />* @package phpmailer<br />* @version $Id$<br />*/<br /><br />require '../class.phpmailer.php';<br /><br />try {<br />	$mail = new PHPMailer(true); //New instance, with exceptions enabled<br /><br />	$body             = file_get_contents('contents.html');<br />	$body             = preg_replace('/\\\\/','', $body); //Strip backslashes<br /><br />	$mail->IsSMTP();                           // tell the class to use SMTP<br />	$mail->SMTPAuth   = true;                  // enable SMTP authentication<br />	$mail->Port       = 25;                    // set the SMTP server port<br />	$mail->Host       = "smtp.163.com"; // SMTP server<br />	$mail->Username   = "[email&#160;protected]";     // SMTP server username<br />	$mail->Password   = "***";            // SMTP server password<br /><br />	//$mail->IsSendmail();  // tell the class to use Sendmail<br /><br />	$mail->AddReplyTo("[email&#160;protected]","First Last");<br /><br />	$mail->From       = "[email&#160;protected]";<br />	$mail->FromName   = "phpmailer";<br /><br />	$to = "[email&#160;protected]";<br /><br />	$mail->AddAddress($to);<br /><br />	$mail->Subject  = "First PHPMailer Message";<br /><br />	$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test<br />	$mail->WordWrap   = 80; // set word wrap<br /><br />	$mail->MsgHTML($body);<br /><br />	$mail->IsHTML(true); // send as HTML<br /><br />	$mail->Send();<br />	echo 'Message has been sent.';<br />} catch (phpmailerException $e) {<br />	echo $e->errorMessage();<br />}<br />?>


------解决方案--------------------
给出你的下载地址

可能是要求的 php 版本太高了吧?
------解决方案--------------------
//$mail->IsSendmail();
这个去掉的话默认是使用系统的mail函数发送邮件的。会不会是这个原因。

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