Jump to content

Email authentication fails/no email sent using every possible combination of PHP mail(), Gmail SMTP, own SMTP and SSL/TLS


L2K

Recommended Posts

 

Quote

 

Technical Details

CubeCart Version
6.5.1
PHP Version (7.3 Recommended)
8.0.28
MySQL Version
5.7.29-0ubuntu0.16.04.1
Server Software
Apache

 

 

Pretty much as per title, no amount of setting any combination of anythong available works. I have other things on the same host using PHP mail and many many things use my own hosts SMTP servers and I even tried using Gmail SMTP, all with plain SMTP and TLS/SSL and either I have issues with the domain name mismatch for the security (SSL cert for hosts email server is in their name but CC won't connect to their server (een though it is the same server behind their FQDN as is behind mine). Gmail also fails with unable to authenticate and PHP mail() just fails. I've turned debuggin up to 4 and still have nothing useful in the logs. I cannot see what CC is doing. 

This is the log when using my own server with TLS which is what I want to do and do do elsewhere (so I know the server works). Just appears CC won't add an exception.

Testing SMTP with TLS - Fail
2023-05-10 20:13:01 Connection: opening to smtp.mydomain.co.uk:2500, timeout=300, options=array()
2023-05-10 20:13:01 Connection: opened
2023-05-10 20:13:01 SMTP INBOUND: "220 smtp3.interdns.co.uk ESMTP"
2023-05-10 20:13:01 SERVER -> CLIENT: 220 smtp3.interdns.co.uk ESMTP
2023-05-10 20:13:01 CLIENT -> SERVER: EHLO www.mydomain.co.uk
2023-05-10 20:13:01 SMTP INBOUND: "250-smtp3.interdns.co.uk"
2023-05-10 20:13:01 SMTP INBOUND: "250-STARTTLS"
2023-05-10 20:13:01 SMTP INBOUND: "250-PIPELINING"
2023-05-10 20:13:01 SMTP INBOUND: "250-8BITMIME"
2023-05-10 20:13:01 SMTP INBOUND: "250-AUTH LOGIN PLAIN"
2023-05-10 20:13:01 SMTP INBOUND: "250 SIZE 26214400"
2023-05-10 20:13:01 SERVER -> CLIENT: 250-smtp3.interdns.co.uk250-STARTTLS250-PIPELINING250-8BITMIME250-AUTH LOGIN PLAIN250 SIZE 26214400
2023-05-10 20:13:01 CLIENT -> SERVER: STARTTLS
2023-05-10 20:13:01 SMTP INBOUND: "220 ready for tls"
2023-05-10 20:13:01 SERVER -> CLIENT: 220 ready for tls
2023-05-10 20:13:01 Connection failed. Error #2: stream_socket_enable_crypto() [<a href='http://docs.php.net/manual/en/function.stream-socket-enable-crypto.php'>function.stream-socket-enable-crypto.php</a>]: Peer certificate CN=`*.interdns.co.uk' did not match expected CN=`smtp.mydomain.co.uk' [/home/switchlec/public_html/admin/pos/classes/PHPMailer/src/SMTP.php line 467]
SMTP Error: Could not connect to SMTP host.
2023-05-10 20:13:01 CLIENT -> SERVER: QUIT
2023-05-10 20:13:01
2023-05-10 20:13:01
2023-05-10 20:13:01
2023-05-10 20:13:01
2023-05-10 20:13:01
2023-05-10 20:13:01 Connection: closed
SMTP connect() failed.

Also possibly related, and would be nice if I could get to the bottom of this error anyway, when using the PHP mail() function (which fails) it gives me this in the error message 

Quote

We recommend using an email address from a domain hosted on this server such as [email protected] for example and this may need to be setup form within your web hosting account.

Where is it getting the email address from (which is clearly wrong)? I can't seem to find this anywhere.

Edited by L2K
Link to comment
Share on other sites

Hopefully, your hosting provider's technical support can determine why the SSL Certificate mismatch is happening.

The message comes from the file /classes/ajax.class.php, near line 449:

return "
<div class=\"mail_modal\">
  <h3>Testing ".$method_name."</h3>
  <p>It isn't possible  to get a definitive test result for the &quot;PHP mail() Function&quot; method.</p>
  <p>We have attempted to send a test email to &quot;".$GLOBALS['RAW']['POST']['email_address']."&quot;
    with the subject of &quot;".$subject."&quot; Please note that it can take ten minutes or even longer for
    a busy mail server to deliver email. Don't forget to check your spam folder!</p>
  <p>This method can fail if the server hasn't been configured properly and may refuse to send mail from
    &quot;untrusted&quot; sources such as Hotmail, Yahoo, AOL etc&hellip;. We recommend using an email
    address from a domain hosted on this server such as sales@".parse_url(CC_STORE_URL, PHP_URL_HOST)."
    for example and this may need to be setup form within your web hosting account.</p>
</div>
";

The test result message uses the website's FQDN (which is held in the constant CC_STORE_URL) as part of the example email address. (It's a bit misleading, for sure.)

Did you say you have other apps that use GMail's server's?

Hopefully, your host allows for the use of external SMTP servers.

This conversation may of interest:

https://forums.cubecart.com/topic/57861-paid-help-required-please-gmail-setup/

 

Link to comment
Share on other sites

8 minutes ago, bsmither said:

Hopefully, your hosting provider's technical support can determine why the SSL Certificate mismatch is happening.

I know why it's happening, the certificate is only for *.interdns.co.uk, usually this isn't an issue and the client will add an exception. Not all do, so I use plain SMTP instead but this still doesn't work with CubeCart.  

I have Joomla and Wordpress using PHP mail() and SMTP on various other accounts on the same host so I don't think the issue is with the host.

10 minutes ago, bsmither said:

The test result message uses the website's FQDN (which is held in the constant CC_STORE_URL) as part of the example email address. (It's a bit misleading, for sure.)

Ah. So it's just for this error message? Was wondering if that variable is sent to the server during the auth process for whatever reason. Overcomplicating it a bit but could probably strip the www. off using another statement in the error message script.

Link to comment
Share on other sites

Actually as I browsed this forum it seems that 4 out of every 5 threads I visit contains spam of some description so not really instilling much confidence in CubeCart at all. I haven't actually used CC for a while, still have a few older shops that I paid for that I need to go and update/upgrade but after seeing the state of the official support forums I feel I should stick with WooCommerce. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...