jka Posted May 6, 2020 Share Posted May 6, 2020 Folks, I have seen others had this issue or similar. We are trying to use SMTP With SSL or SMTP with TLS. All the fields are populated properly and 465 is used for SSL and 587 is used for TLS. However this is what happens ... Can someone point to this code in CC? Store is 6.1.12 and php version is 7.2.30. Error message for SSL... from maillog .. postfix/smtpd[24655]: connect from localhost.localdomain[::1] postfix/smtpd[24655]: lost connection after CONNECT from localhost.localdomain[::1] postfix/smtpd[24655]: disconnect from localhost.localdomain[::1] Error message for TLS .. from maillog postfix/smtpd[24747]: connect from localhost.localdomain[::1] postfix/smtpd[24747]: lost connection after STARTTLS from localhost.localdomain[::1] postfix/smtpd[24747]: disconnect from localhost.localdomain[::1] From the Pop-Up window on Cubecart ... CLIENT -> SERVER: STARTTLS SERVER -> CLIENT: 220 2.0.0 Ready to start TLS SMTP Error: Could not connect to SMTP host. CLIENT -> SERVER: QUIT SERVER -> CLIENT: SMTP ERROR: QUIT command failed: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting FYI, Sending mail as PHP() Mail Function works properly. Link to comment Share on other sites More sharing options...
bsmither Posted May 6, 2020 Share Posted May 6, 2020 What's the 'maillog'? With CC6.1.12, I think using the Test button required saving the settings first. (Admin, Store Settings, Advanced tab, Test button) I am using PHP 7.4 to connect to GMail's SMTP server: Testing SMTP with TLS 2020-05-06 22:36:49 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP 189sm2851287pfd.55 - gsmtp 2020-05-06 22:36:49 CLIENT -> SERVER: EHLO cc629.example.com 2020-05-06 22:36:49 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [IP-Address]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8 2020-05-06 22:36:49 CLIENT -> SERVER: STARTTLS 2020-05-06 22:36:49 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS 2020-05-06 22:36:49 CLIENT -> SERVER: EHLO cc629.example.com 2020-05-06 22:36:49 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [IP-Address]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8 2020-05-06 22:36:49 CLIENT -> SERVER: AUTH LOGIN I am seeing Internet search results of complaints that PHPMailer has problems with PHP 7.4 built with an older version of the PCRE library: https://wordpress.org/support/topic/cant-send-emails-using-php-7-4/ Link to comment Share on other sites More sharing options...
jka Posted May 6, 2020 Author Share Posted May 6, 2020 Hello BSmither, We are saving everytime to test. The PCRE library from PHP Info is 10.32. So it also seems to be the latest. If we can see the code thats making the call, we can try to add some debug see why the connection is closed after the server says Hello. Link to comment Share on other sites More sharing options...
bsmither Posted May 7, 2020 Share Posted May 7, 2020 That would be in the PHPMailer library in /classes/PHPMailer/. The actual error message is generated in (for the version of PHPMailer shipped with CC6112) class.phpmailer.php near line 1678. This is generated if TLS fails from a function at class.smtp.php, public function startTLS(). For CC6112, you will start looking at /classes/ajax.class.php, public static function SMTPTest(). This sets SMTPDebug = 2. You may want to change this to 4, which gets you a much more verbose output. Link to comment Share on other sites More sharing options...
bsmither Posted May 7, 2020 Share Posted May 7, 2020 You may want to explore phpinfo() and look for the following in the top table: Registered Stream Socket Transports: tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3 Link to comment Share on other sites More sharing options...
jka Posted May 7, 2020 Author Share Posted May 7, 2020 This is what I found on phpinfo() Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2 Link to comment Share on other sites More sharing options...
jka Posted May 7, 2020 Author Share Posted May 7, 2020 Hello BSmither, Making SMTPDebug = 4 gave the clue. The CN mismatch was causing it. Fixed it. Now both SSL and TLS works as well as PHP Mail Function. Thanks. Link to comment Share on other sites More sharing options...
sack123 Posted November 4, 2021 Share Posted November 4, 2021 How can I call PHP mail() function to use in another code to send email for notification?. Which file I need to include and where can I find the mail() defination ? Link to comment Share on other sites More sharing options...
bsmither Posted November 4, 2021 Share Posted November 4, 2021 In CubeCart, all mail functions are handled by PHPMailer (in the /classes/ folder). When PHPMailer is told to use PHP's mail() functions, PHPMailer will query PHP's INI settings (php.ini file), where info about what application is available and how to structure the commands sent to that application are located. See: https://www.php.net/manual/en/mail.configuration.php#ini.sendmail-path Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.