An error occurred while attempting to establish an SSL or TLS connection while sending email

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
jayc wrote:
Ok, I had a quick look at the code and did a test run.

It was failing within SmtpBuilder.cs on this line:
client.Connect(
                    emailAccount.Host,
                    emailAccount.Port,
                    emailAccount.EnableSsl ? SecureSocketOptions.SslOnConnect : SecureSocketOptions.StartTlsWhenAvailable);

For everyone running office365/exchange online, you should have the SSL unchecked in nop which will use TLS secure socket where possible. This should work with the following configuration:
Host: smtp.office365.com
Port: 587
SSL: unchecked
Use default credentials: false

Working for my environment using the current referenced libary MailKit 2.6 and the latest MailKit 2.9.

IMO, I believe the email Admin in nop should allow the user to select any of the SecureSocketOptions enum options to cater for any scenario but the default should be TLS moving forward.


Thank you Jayc, your suggestions on SSL (Unchecked) and Use default credentials (Unchecked) worked on Office 365.

Are you getting emails from Contact Us form? We are getting 'SendAsDeniedException.MapiExceptionSendAsDenied' error.

Thank you,
Anup
3 years ago
anupkum wrote:

Are you getting emails from Contact Us form? We are getting 'SendAsDeniedException.MapiExceptionSendAsDenied' error.

Thank you,
Anup


Mines OK. Check that your nop email account matches the email from address on your contact us form.
3 years ago
So, as written earlier if you have unchecked the SSL setting then nopCommerce will use TLS secure socket where possible. Also, an important note: by default for new Office 365 tenants, SMTP Auth is disabled. You can try to enable it in the Admin Portal or through the PowerShell tool:
https://docs.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission#use-the-microsoft-365-admin-center-to-enable-or-disable-smtp-auth-on-specific-mailboxes
3 years ago
Perhaps the description should be changed to reflect better how it works.

"Use SSL protocol only" may be a better name
3 years ago
So, I'm having the same issue with the nop 3.4:
I'm trying to use gmail as my email account with the following configuration:
host: smtp.gmail.com
port:587
SSL- checked
Use default credentials - unchecked.
And it does not work - Can you please help me with that?
Any help is most welcome!

Lior.


An error occurred while attempting to establish an SSL or TLS connection. This usually means that the SSL certificate presented by the server is not trusted by the system for one or more of the following reasons: 1. The server is using a self-signed certificate which cannot be verified. 2. The local system is missing a Root or Intermediate certificate needed to verify the server's certificate. 3. A Certificate Authority CRL server for one or more of the certificates in the chain is temporarily unavailable. 4. The certificate presented by the server is expired or invalid. Another possibility is that you are trying to connect to a port which does not support SSL/TLS. It is also possible that the set of SSL/TLS protocols supported by the client and server do not match. See https://github.com/jstedfast/MailKit/blob/master/FAQ.md#SslHandshakeException for possible solutions.
3 years ago
@shamilal
Please don't duplicate topics.  Did you see what I replied your other post? Did you make adjustments in your gmail account?  (please reply in the other topic)
https://www.nopcommerce.com/en/boards/topic/90087/test-email-not-working#280452
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.