SSL Email via port 465 not working

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
I know this question was asked before, but there are no working answers (never did get SSL email to work since we started using NC) anywhere to be found, but today I absolutely must get SSL email to work (the email server will no longer support SMTP unencrypted connections).
Using NC ver 4.0 and set the port # to 465 and checked the Use SSL box, but every time, no matter what credentials are used, it won't send an email. (there are no error messages logged in NC, either!)

Nonencrypted email works just fine on the older versions of NC (can't test it). Email from a client like Outlook, works fine (SSL port 465) as well. So we know it's something to do with IIS or NOP (not sure). Another ASP.Net app is connecting to the same server (webforms & another MVC app) with the same credentials under port 465.

Here's the error when I try this with NC 4.0
Port 465: Implicit SSL initialisation error or client closed connection unexpectedly.


Please note: The email server is using IMPLICIT SSL on port 465.  <- Does NC not support such connections? If not, is there a 3rd party mail plug in that will allow this?
6 years ago
Hi Beefydog

You may wont to take a look at this artical : http://forum.codecrafters.com/viewtopic.php?f=6&t=281, it suggests that it maybe an issue with the SSL Certificate.

Hope it helps.
6 years ago
It's a Comodo cert, not self-signed.
I'm going to dig into the code to see method NOP is using to handle certs. Like I mentioned, I have a webforms app that works fine with the same credentials, port & certificate.
6 years ago
I traced the inner exception:
Unable to read data from the transport connection: net_io_connectionclosed.

stack trace:
   at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)
   at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
   at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
   at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
   at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
   at System.Net.Mail.SmtpClient.GetConnection()
   at System.Net.Mail.SmtpClient.Send(MailMessage message)


I tried bypassing the certificate check with this line right before the send
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate);

The function ValidateServerCertificate just returns true (effectively accepting any certificate):

public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors__1)
        {
            return true;
        }


From what I can see, it's not the cert that's the problem, but something in the handshake.
This is beyond my expertise.
6 years ago
Okay. This link explains a lot
https://stackoverflow.com/questions/1011245/how-can-i-send-emails-through-ssl-smtp-with-the-net-framework/1014876#1014876

In a nutshell, the System.Net.Mail namespace does NOT support IMPLICIT SSL. The older System.Web.Mail namespace (which my other sites are using) does support it.
Also, port 465 was deprecated 20 years ago (even though it's still in use today).

So, to answer my question, this won't work on NOP Commerce w/o code changes (because System.Net.Mail namespace is what is utilized).
6 years ago
Hi guys,
sorry for intromission,
may this problem be the same as mine?
https://www.nopcommerce.com/boards/t/50281/39-error-sending-e-mail-the-operation-has-timed-out.aspx
6 years ago
I don't believe so. Mine seems like a port problem, but using port 587 is not working either. Transport errors.  I'm going to try running this live - perhaps it's an IISExpress problem. Not sure, just trying different things. We absolutely must have SSL for email now (due to PCI compliance) and have been going unecrypted for years w/NOP, so maybe this is an ongoing problem.
6 years ago
Here's a solution that works perfectly with implicit SSL. Add MailKit to your project and a couple of minor changes.

https://github.com/jstedfast/MailKit
3 years ago
beefydog wrote:
Here's a solution that works perfectly with implicit SSL. Add MailKit to your project and a couple of minor changes.

https://github.com/jstedfast/MailKit


Hello,
Actually the MAilKit is implemented in NopCommerce 4.30, but I still have this problem with SMTP and SSL, my Web Site can't send emails (while the same configuration with desktop mail client works fine)
Any help please?
3 years ago
Which port are you using in your store's email account settings?
https://github.com/nopSolutions/nopCommerce/issues/4447

make sure that you are using correct protocol ports: 465 with SSL security or 587 with TLS by default
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.