简体   繁体   English

在PHP 5.6上使用SMTP的PHP Mailer错误

[英]PHP Mailer Error using SMTP on PHP 5.6

I've been using PHP Mailer in version 5.2.1 for some time in my application. 在我的应用程序中,我一直在使用5.2.1版的PHP Mailer。 It was working flawlessly in PHP 5.4 with no secure SMTP. 在没有安全SMTP的PHP 5.4中,它可以完美地工作。

Now I've been trying to use it with PHP 5.6 version and PHP Mailer give me this errors: 现在,我一直在尝试将其与PHP 5.6版本一起使用,并且PHP Mailer给我这个错误:

SMTP -> FROM SERVER:220 lbc6.cloud.netart ESMTP ready
SMTP -> FROM SERVER: 250-lbc6.cloud.netart 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-SIZE 1073741824 250-8BITMIME 250-AUTH PLAIN LOGIN 250 STARTTLS
SMTP -> FROM SERVER:220 2.0.0 Start TLS
SMTP -> FROM SERVER:
SMTP -> ERROR: RSET failed: 

Idk if this is an server error or should I update PHP Mailer. 如果这是服务器错误,则为Idk还是应该更新PHP Mailer。

EDIT: ---------------------------------------------------------------------------------------------------------------------- 编辑:------------------------------------------------ -------------------------------------------------- --------------------

I've updated PHP Mailer to newest version using composer. 我已经使用composer将PHP Mailer更新为最新版本。 Now I'm getting "Could not connect to SMTP host." 现在,我收到“无法连接到SMTP主机”。

Also PHP mailer's errors show this: PHP邮件程序的错误也显示以下内容:

2017-01-19 10:51:25 SERVER -> CLIENT: 220 lbc6.cloud.netart ESMTP ready
2017-01-19 10:51:25 CLIENT -> SERVER: EHLO www.poligon4.webinkubator.pl
2017-01-19 10:51:25 SERVER -> CLIENT: 250-lbc6.cloud.netart 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-SIZE 1073741824 250-8BITMIME 250-AUTH PLAIN LOGIN 250 STARTTLS
2017-01-19 10:51:25 CLIENT -> SERVER: STARTTLS
2017-01-19 10:51:25 SERVER -> CLIENT: 220 2.0.0 Start TLS
2017-01-19 10:51:25 SMTP Error: Could not connect to SMTP host.
2017-01-19 10:51:25 CLIENT -> SERVER: QUIT
2017-01-19 10:51:25 SERVER -> CLIENT:
2017-01-19 10:51:25 SMTP ERROR: QUIT command failed:
2017-01-19 10:51:25 SMTP Error: Could not connect to SMTP host. 

I have no idea what to do now. 我不知道该怎么办。

5.2.1 is very old. 5.2.1很老了。 Since then PHPMailer gained the ability to enable encryption automatically if the server offers it; 从那时起,PHPMailer获得了服务器提供自动加密功能。 at the same time, PHP 5.6 introduced certificate validation by default, so it's likely you are failing due a bad cert or poor TLS config on the mail server. 同时,PHP 5.6默认情况下引入了证书验证,因此很可能由于邮件服务器上的证书错误或TLS配置不正确而失败。 Read the PHPMailer troubleshooting guide to see what's up and figure out how to fix it. 阅读《 PHPMailer故障排除指南》以了解最新情况并找出解决方法。

I found answear for my problem with PHP 5.6 我发现我的问题与PHP 5.6有关

This version is a very strick with it's SSL Certificate and it was blocking my atempts to send mail. 这个版本的SSL证书非常醒目,它阻止了我发送邮件的尝试。

Unitl I find out how to resolve this, I have temporary solution: 我找到了Unitl的解决方法,我有一个临时解决方案:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM