您的位置:首页 > 编程语言 > PHP开发

SMTP Error: Could not connect to SMTP host.

2013-10-09 21:12 711 查看
使用 PHPmailer类发送邮件的时候出现SMTP Error: Could not connect to SMTP host. (链接不到SMTP服务器)

以及后来遇到的Could not instantiate mail function.问题

把$this->Mailer='smtp' 改成大写 $this->Mailer='SMTP'

注意:这里不止一处,下文用class.phpmailer.php中

switch($this->Mailer) {
case 'sendmail':
return $this->SendmailSend($header, $body);
case 'smtp':
return $this->SmtpSend($header, $body);
default:
return $this->MailSend($header, $body);
}


这里的小写也要大写

ps:如果使用qq邮箱或者Gmail邮箱发送,服务器必须支持SSL php.ini文件用改的 extension=php_openssl.dll前面去掉“;”

如果还是不行,看看phpinfo();sockets 有没有打开,没有的话 extension=php_sockets.dll 前面也去掉“;”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: