使用 PHPmailer類發送郵件的時候出現SMTP Error: Could not connect to SMTP host. (連接不到SMTP服務器)php
以及後來遇到的Could not instantiate mail function.問題服務器
把$this->Mailer='smtp' 改爲大寫 $this->Mailer='SMTP'socket
注意:這裏不止一處,下文用class.phpmailer.php中this
switch($this->Mailer) { case 'sendmail': return $this->SendmailSend($header, $body); case 'smtp': return $this->SmtpSend($header, $body); default: return $this->MailSend($header, $body); }
這裏的小寫也要大寫spa
ps:若是使用qq郵箱或者Gmail郵箱發送,服務器必須支持SSL php.ini文件用改的 extension=php_openssl.dll前面去掉「;」code
若是仍是不行,看看phpinfo();sockets 有沒有打開,沒有的話 extension=php_sockets.dll 前面也去掉「;」blog