开发者社区> 问答> 正文

centos 邮件无法发送

用的华东2 ECS  centos6.8 32位
phpmailer发送邮件 返回错误
[font="]2017-11-24 02:44:42    
[font="]SMTP ERROR: Failed to connect to server: Connection timed out (110)
[font="]2017-11-24 02:44:42    
[font="]SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting


百度了很多都无法解决,有说是无法连接到smtp服务器的问题。我远程主机操作 ping smtp.qq.com  是正常的。防火墙也配置了允许25端口。
也有说sendmail的问题。服务器也有安装sendmail 。phpmailer上配置的sendmail路径也没有问题。


求大神们的帮助

展开
收起
花晨月夕 2017-11-24 10:48:50 7643 0
4 条回答
写回答
取消 提交回答
  • Recentos 邮件无法发送
    目前遇到同样的问题,相同的配置在windows下是可以正常发送邮件,但是到了阿里云的ESC上,就报错误
    Failed to connect to server: (0)
    SMTP connect() failed

    楼主是如何解决的,能否将配置发一下,多谢
    2018-07-19 09:52:24
    赞同 展开评论 打赏
  • 回 2楼dongshan8的帖子
    感谢回复。换了ssl验证方式。问题依旧

    -------------------------

    回 1楼火蓝云的帖子
    感谢回复,用了ssl验证方式也不行。465或587端口都试了

    -------------------------

    Recentos 邮件无法发送
    不好意思,端口搞错了。现在可以了。用ssl方式验证。感谢楼上两位大哥
    2017-11-24 21:33:07
    赞同 展开评论 打赏
  • 旺旺:nectar2。
    版主回复:

    phpmailer的说明中( https://github.com/PHPMailer/PHPMailer),内置了smtp的发信方式,无需本地有邮件服务。

    如其中提到的例子:

      $mail->SMTPDebug = 2;                                 // Enable verbose debug output
        $mail->isSMTP();                                      // Set mailer to use SMTP
        $mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
        $mail->SMTPAuth = true;                               // Enable SMTP authentication
        $mail->Username = 'user@example.com';                 // SMTP username
        $mail->Password = 'secret';                           // SMTP password
        $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
        $mail->Port = 587;                                    // TCP port to connect to


    2017-11-24 19:14:47
    赞同 展开评论 打赏
  • 乐善好施
    服务器禁止使用25端口,可以修改源码 使用 ssl 的465端口发送邮件
    2017-11-24 11:10:29
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载
低代码开发师(初级)实战教程 立即下载