A-A+

网站CMS系统phpmailer发送邮件失败解决办法——大写SMTP

2016年02月17日 Linux, 网站建设 暂无评论 阅读 2,575 views 次

很多网站CMS都是使用的phpmailer来发送邮件。

安装好lnmp环境后,发现一些使用smtp发送邮件的网站CMS系统无法发送邮件,提示:Could not connect to SMTP host 错误。

原因:

原因是PHPMailer里面有一个判断的函数

public function IsSMTP(){

$this->Mailer='SMTP';

}

switch($this->Mailer){

case ''sendmail;

return $this->SendmailSend($header,$body);

case 'snto';  //注意,SMTP和smtp不想等,所以选择的是默认的MailSend发送邮件而不是smtp发送了。

retrun $this->SmtpSend($header,$body);

default;

return $this->MailSend($header,$body);

所以解决办法:

在class.phpmailer.php中,将

function IsSMTP(){

$this->Mailer='smtp';

}

修改为

function IsSMTP(){

$this->Mailer='SMTP';

}

标签:

给我留言