Cannot send email in Linux with Aspose.Email and Office 365

Hello,
We use Aspose.Email v21.11 with .NET 6 to send emails.
When the code is executed in Windows, it works very well with all SMTP providers (Office 365, Sendgrid, amazon SES, …).

But when I run the code in Linux Ubuntu ( 22.04 LTS), the emails cannot be sent when we use Office 365 SMTP. It can be sent with other SMTP providers, like amazon SES.

The error message is: “Cannot determine the frame size or a corrupted frame was received.”

I made some research on the web. Most articles said that the problem comes from TLS.
I added the code below, but I still get the error.

client.SupportedEncryption = EncryptionProtocols.Tls12 | EncryptionProtocols.Tls11 | EncryptionProtocols.Tls;

client.SetSupportedEncryptionUnsafe(EncryptionProtocols.Tls12);

Please, does anyone have any idea how to fix the problem?

Thanks

@pacoumamou

You are using very old version of Aspose.Email with .NET 6.0. Please use the latest version of Aspose.Email for .NET 22.7 and let us know how it goes on your side. Hope this helps you.

Hi @tahir.manzoor,
Thank you very much for your response.
I tested with version 22.7, and I got a different error message.
I searched on the web, and I found a solution :slight_smile:
I added the following code line, which works with 21.11 and 22.7.

client.HelloMessage = client.Host.ToLower();

For Office 365 and maybe for some other SMTP providers, you need to set the hello message with the hostname in lowercase.

I hope this helps other people in the same situation.

Thanks

@pacou06

It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Email, we will be happy to help you.