(1)服务器不能使用smtp的形式发送邮件
解决办法:很多网站列出的解决办法说是因为smtp大小写的问题,虽然问题的本质不在这里,但确实也需要改这个地方,至于为什么,看下面的操作。
在 class.phpmailer.php 中,将:
function issmtp(){$this->mailer='smtp';}
改成:
function issmtp(){$this->mailer = 'smtp';}
这个地方的修改不是使用了smtp来发送邮件,而是使用了另外一种方式发送邮件,检查 class.phpmailer.php 文件里面有下面这么一段:
switch($this->mailer){ case 'sendmail': return $this->sendmailsend($header, $body); case 'smtp'://由于smtp和smtp不相等 所以选择的是下面mailsend发送邮件 并不是使用smtp发送邮件 return $this->smtpsend($header, $body); default: return $this->mailsend($header, $body);}
(2)linux主机禁用了fsockopen()函数
国内有很多空间服务商出于安全考虑会禁用服务器的fsockopen函数。
解决方法:
用pfsockopen() 函数代替 fsockopen() ,如果 pfsockopen 函数也被禁用的话,还可换其他可以操作socket函数来代替, 如stream_socket_client()
在 class.smtp.php 中将 @fsockopen 改成 @pfsockopen
把
$this->smtp_conn = @fsockopen($host, // the host of the server $port, // the port to use $errno, // error number if any $errstr, // error message if any $tval); // give up after ? secs
改成:
$this->smtp_conn = @pfsockopen($host, // the host of the server $port, // the port to use $errno, // error number if any $errstr, // error message if any $tval); // give up after ? secs
(3)防火墙安全设置规则,如果以上两种方案都不凑效,那估计是防火墙的规则问题了,可以让服务器管理员去掉所有的防火墙规则,然后测试一下,看是否是这个原因。
您可能感兴趣的文章fatal error call to undefined function date_default_timezone_set()fatal error class 'soapclient' not found in ...错误处理办法fatal error class 'ziparchive' not found ...... 的解决办法php提示php warning: date(): it is not safe to rely on the......错误的解决办法php提示maximum execution time of 30 seconds exceeded...错误的解决办法网页缓存控制 cache-control 常见的取值有private、no-cache、max-age、must-revalidate 介绍该如何解决php运行出现call to undefined function curl_init错误php output control 深入理解 ob_flush 和 flush 的区别
http://www.bkjia.com/phpjc/764172.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/764172.htmltecharticle(1)服务器不能使用smtp的形式发送邮件 解决办法:很多网站列出的解决办法说是因为smtp大小写的问题,虽然问题的本质不在这里,但确实...
