• 服务器发送邮件出现Could not connect to SMTP host错误 解决办法


    服务器发送邮件出现Could not connect to SMTP host错误 解决办法

    功夫不负有心人,最后了解到,除了google的smtp服务器收到请求“smtp”会接受,其他服务器比如qq 163什么的必须要收到“smtp”请求(大写),郁闷呀!

    解决办法:

    在 class.phpmailer.php 中,将

    function IsSMTP() {

    $this->Mailer = 'smtp';

    }

    改成:

    function IsSMTP() {

    $this->Mailer = 'SMTP';

    }

    再次测试,终于看到了熟悉的面孔,  QQ右下角提示 收到新邮件!问题解决!舒心呀!

    后来我发现并不是因为修改了smtp为SMTP之后却能够发送邮件,这个并不是因为有些邮件服务器不能接受smtp的原因,而是并不是使用了smtp来发送邮件,PHPmailer里有一个判断的函数,
    public function IsSMTP() {
    $this->Mailer = 'SMTP';
    }

    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);

  • 相关阅读:
    webuploader web 大文件上传源代码
    poj 1703 Find them, Catch them
    poj 1308 Is It A Tree?
    hud 1785 畅通工程
    食物链 poj 1182
    poj 1611 The Suspects 并查集
    poj 2524 并查集 Ubiquitous Religions
    The Suspects 简单的并查集
    cf 621D
    hdu2159
  • 原文地址:https://www.cnblogs.com/crystaltu/p/5755808.html
Copyright © 2020-2023  润新知