Office365 SMTP Send Mail error - IIS Windows Server 2019

I am having an issue with the Mailer sometimes not sending emails. The email is hosted on Office365 and I have configured SMTP with SSL enabled on Port 587.

When I submit the form (to send a login authentication code), the SA fails with an error Exception message: Authentication failed because the remote party has closed the transport stream.

This doesn’t happen all the time; the mail is sent out correctly if I try to submit the form a few times, generally 3-4 times, after the repeated errors.

Has anyone else come across this issue with Office365 SMTP and was there any resolution? Any help in resolving this issue is greatly appreciated.

Hey @guptast
I don’t know at all, but just in case, I have found a few thread related to this issue, maybe it will help!

Thanks for the links @ChristopheA

I forgot to mention that my web app is hosted on IIS with .NET v4.0 running on Windows Server 2019.

The links are referring to changing the SecurityProtocolType.TLS to at least TLS1.2. There’s no direct method to setup the Security Protocol other than either including it in the application or changing the registry settings. I would prefer including this security protocol information in the application; but not sure where this setting can be updated.

I resolved this issue by using another SMTP email service provider (Mailgun in my case). If someone is having a similar issue with Office365 SMTP emails not being sent out, then I’ll recommend signing up with another SMTP/Email service provider and use their mail server settings to send out emails.

Once the required domain name has been added / verified in the new service provider’s system, check SMTP credentials and add these in Wappler Mailer settings. In Mailgun’s case, I didn’t need to add / change MX records from Office365 (under DNS settings) as I didn’t want to use them for my primary mail server.