Same problem here.
Mail sending worked flawlessy unitl 1st oct. 2021 using SmtpClient in our applications targeting Framework 4.0. Unfortunately in the last days many of our customers using Office365 reported "Authentication failed because the remote party has closed the transport stream" error during some mail sending sessions.
It's not a constant error, after retrying a few times it works.
Our customers are mainly distributed throughout Italy, so i don't think the error to be related to physical connection issues.
We use "SmtpClient" like this, by assigning "SecurityProtocolType" casting 768 and 3072 to enum (since our platform require targeting Framework 4.0, we don't have Tls11 and Tls12 enum value):
ServicePointManager.SecurityProtocol =
SecurityProtocolType.Tls Or
DirectCast(768, SecurityProtocolType) Or
DirectCast(3072, SecurityProtocolType)
ServicePointManager.ServerCertificateValidationCallback = Function() True
ClientMail = New SmtpClient()
ClientMail.TargetName = "STARTTLS/smtp.office365.com"
ClientMail.EnableSsl = True
ClientMail.DeliveryMethod = SmtpDeliveryMethod.Network
It has always worked but now we are having a lot of troubles.
Any help?