Description
Description
We utilized SmtpClient.SendAsync
for email dispatch, yet faced user reports of undelivered emails, despite our system appearing functional. The issue was eventually linked to specific HTML email body content, suggesting a possible size-related problem—removing a few lines from the email body seemed to resolve the sending issue.
Our emails are sent via Office 365 (there are no logs for the failed emails). To eliminate the possibility of the issue being specific to Office 365, I also tried using a different email provider, but encountered the same problem.
Note this issue only started after we switched to .NET 8 from .NET 6. Also if we change to the synchronous version of the Send method it delivers the email.
Reproduction Steps
I have attached a small console application that replicates the issue. You will of course need to supply your own credentials and delivery emails.
TestSendEmail.zip
Expected behavior
Expect delivery of emails.
Actual behavior
Nothing is sent.
Regression?
.NET 6 works
Known Workarounds
Use SmtpClient.Send
instead or in our case we moved to MailKit.
Configuration
.NET 8
Windows 11 x64 - although it also fails on docker image mcr.microsoft.com/dotnet/sdk:8.0-alpine as well
Other information
No response