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
What is your website domain ?
You can check if you have a SSL Certificate installed
https://www.ssllabs.com/ssltest/
3 years ago
try to set port to "465" instead of "587"
3 years ago
Is it confirmed if this is a code related issue in 4.3 or if its a setup/config issue? Iam having the same trouble
3 years ago
No, this is not a code related issue. Most of the cases I saw that it is mail server configuration related issue.
3 years ago
SMTP Port is not working in office 365. Though it worked in Gmail by using app password, it's not working on office 365.

Email address: [email protected]
Email display name: Store name
Host: smtp.office365.com
Port: 587
User: [email protected]
Password  
SSL: checked  
Use default credentials: unchecked

Thanks in advance for any help.
3 years ago
MirzaJalal wrote:
SMTP Port is not working in office 365. Though it worked in Gmail by using app password, it's not working on office 365.

Email address: [email protected]
Email display name: Store name
Host: smtp.office365.com
Port: 587
User: [email protected]
Password  
SSL: checked  
Use default credentials: unchecked

Thanks in advance for any help.


I can share your frustration because your setup should in theory just work. I had the same configuration from 3.xxx to 4.2 and office365/Exchange Online emails worked flawlessly. Once I installed 4.3, the setup worked up to a point and then finally had a certificate error out of no where which everyone else has been complaining about.

As my nop website is hosted in Azure (I assume exchange online is too), I had set SSL unchecked and had no problems ever since. I haven't had time to investigate why, if its really a nopcommerce mailkit issue or some sort of environment amendments in Azure.

I do know Azure had notified of TLS certificate changes but I don't know if this impacts nop.

https://docs.microsoft.com/en-us/azure/security/fundamentals/tls-certificate-changes
3 years ago
Thank you for your response. I have tried both in the localhost and in azure.  However, it's not working at all. I also attempted by unchecking the SSL.
3 years ago
Hello! @MirzaJalal,

For us it is not working on Office 365 mail (our nopCommerce 4.3 hosting is on a VPS).

@monowar.mbstu, helped us a lot.

Finally we moved the email server to Zoho. The mails are working on both Zoho personal and Zoho professional email plans.

I think only way to figure out what is happening on Office 365 configuration is through debugging the source code and making changes to the settings of Mailkit code.  This is the conclusion myself and @monowar.mbstu arrived on this issue.

Thanks all of you for supporting us on this issue.
3 years ago
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.
3 years ago
Im using office 365 and the uncheck of ssl did the trick now its working.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.