HotcakesCommerce / hotcakes-commerce-core

The core of the e-commerce part of the overall solution. This is an ecommerce shopping cart solution built on top of the DNN (DotNetNuke) CMS. Anyone can do commerce online now!
https://mmmcommerce.com
MIT License
67 stars 55 forks source link

DNN SMTP Mail Provider with SSL #453

Closed james7342 closed 11 months ago

james7342 commented 1 year ago

Describe the bug

Mail Server configured in DNN to use SSL. When HCC sends email results in an error, "Server does not support secure connections."

Software Versions

Expected behavior

Email is sent and no error

Actual behavior

Email not sent and Event Error

Screenshots

screenshot_813

Error log

N/A

Additional context

I suspect this is due a port issue. As turning of SSL in DNN SMTP Mail Settings resolves issue. System.net.mail provider maybe defaultng to port 25 and SSL on most servers requires port 587. On a side note I do have DNN configured to use MailKit though I don't think that's an issues as it appears HCC is using the System.net.mail provider. HCC should use SMTP port DNN is using to send mail. I believe HCC is trying to honor the SSL requirement but using the incorrect port to make the connection.

WillStrohl commented 12 months ago

I don't think this is a Hotcakes Commerce issue. I believe if you include the port number in your DNN SMTP settings, you may resolve this issue. Have you tried that yet? (See the example in the image below.)

image

james7342 commented 12 months ago

I wasn't using the :587 port in the URL and only had SSL enabled toggle. Which was working fine for normal DNN emails and i was only getting this above alert for HCC emails. I would have to test with the :587 port in the URL to see if that resolves it. I guess I sort of assumed with SSL toggle it would us port 587 would be used. Maybe it's just doing SSL over port 25.

screenshot_949
WillStrohl commented 12 months ago

Putting in the port number is not always required. It more so depends on how the communication from DNN is parsed by the respective SMTP relay provider you're attempting to connect to.

For the most part, emails from DNN and Hotcakes Commerce should be using the same code. Our email logic wraps the DNN API email endpoints.

WillStrohl commented 11 months ago

It's better to send anything securely, if you can. Did the port number change work, or no?

james7342 commented 11 months ago

Tested a couple things here today.

  1. Adding just port 587 to the SMTP Server field works. DNN Test Email, site emails and HCC emails are successful and no errors in the logs.
  2. Adding port 587 and also toggling the "SMTP Enable SSL" generated the error for HCC emails. DNN Test Email and Sites emails are successful.

screenshot_955

There is something with the DNN "SMTP Enable SSL" toggled on. When enabled the DNN "Test SMTP Settings" is successful along with other DNN site based emails. Which leads me to believe SMTP SSL is working.

The only module throwing the error is HCC. @WillStrohl - Do you have it toggled on in your configuration along with port 587 configured?

I'll reach out to our hosting PowerDNN/Managed.com to see if their SMTP relay services support SMTP SSL. I'm not sure if DNN "SMTP Enables SSL" tries SSL and falls back to non secure. Which is why all my normal DNN site emails work with it toggled on. Maybe my SMTP server doesn't support SSL and HCC using its own SMTP provider is trying to force SSL.

Something is strange here just not sure if it's DNN, HCC or my SMTP Mail Relay.

james7342 commented 11 months ago

I think I’ve got the answer here. PowerDNN/Managed.com SMTP relay service doesn’t have SSL enabled.

From my support case. “The relay does not have SSL enabled”

So this looks more like a DNN issue as the “Enable SMTP SSL” toggle doesn’t actually enforce SSL. Though HCC is when it sees this enabled in the DNN configuration. Which is exactly what the generated error message is indicating.

I’ll work on getting a discussion/issue started over there.

WillStrohl commented 11 months ago

Ah, well they really should support SSL to protect the emails going through. :(

Anyhow, it sounds like this isn't an issue anymore.

james7342 commented 11 months ago

@WillStrohl Thanks for help on this. Adding my discussion from the DNN.Platform project.

https://github.com/dnnsoftware/Dnn.Platform/discussions/5753

WillStrohl commented 11 months ago

My pleasure :)