(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大小寫問題,雖然問題的本質不在這裡,但確實...