hi,欢迎访问本站!
当前位置: 首页编程开发正文

phpmailer报错Failed to connect to server: (0) SMTP connect()解决方法

墨初 编程开发 212阅读

今天在测试phpmailer时发现了如下的错误,针对这个错误下面提供了几种解决方案,大家可以参考一下。

phpmailer报错代码

Failed to connect to server: (0) SMTP connect()

phpmailer错误解决方法

1、仔细检查phpmailer的配置,看看有没有设置错误的地方

2、修改邮箱的授权码

(1)、在发信邮箱的官方的邮箱设置里重新设置授权码

(2)、将新的邮箱授权码填写到phpmailer的配置中

(3)、重新发邮件测试

3、修改phpmailer的配置代码

下面是phpmailer修改的代码,可以测试一下。

$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);

4、如果以上方法都不管用,可以在一些其它配置的服务器上进行测试。

PS:以上就phpmailer的错误的解决方案,如果以上的方法都解决不了错误,可以找专业人士进行解决。

声明:无特别说明,转载请标明本文来源!
相关推荐