简体   繁体   中英

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. It was working flawlessly in PHP 5.4 with no secure SMTP.

Now I've been trying to use it with PHP 5.6 version and PHP Mailer give me this errors:

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.

EDIT: ----------------------------------------------------------------------------------------------------------------------

I've updated PHP Mailer to newest version using composer. Now I'm getting "Could not connect to SMTP host."

Also PHP mailer's errors show this:

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. Since then PHPMailer gained the ability to enable encryption automatically if the server offers it; 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. Read the PHPMailer troubleshooting guide to see what's up and figure out how to fix it.

I found answear for my problem with PHP 5.6

This version is a very strick with it's SSL Certificate and it was blocking my atempts to send mail.

Unitl I find out how to resolve this, I have temporary solution:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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