We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Email is not working with TLS1.2 for .NET Framework 3.5

I passed your questions to our development team. Thank you for your patience.

Hi @Andrey_Potapov,

I was just wondering if there were any further updates to this.

Thanks, Julie

I requested news on this issue from our development team again. I will let you know as soon as possible.


Our development team tried with a Gmail account.

We are investigating this case, but we have several questions:

  1. Does the error reproduce with different accounts? Have any changes been made to the settings of these accounts?
  2. Is the error reproducible only on Windows Server 2019?
  3. Did you use Aspose.Email for .NET 3.5 or .NET 3.5 ClientProfile?
  4. Is the error reproducible in a standalone minimal application without your application code?

Hi @Andrey_Potapov,

  1. I can reproduce with gmail and outlook accounts. No changes have been made to these accounts. However, as I previously noted you have to allow for “Less secure App Access” to be able to access the mailbox in the first place.

  2. As well as Windows Server 2019 I can reproduce on Windows Server 2016 (14393.4350).

  3. I am using .NET 3.5 not the ClientProfile one.

  4. I reiterate, that in ALL cases I can make the same code that fails when only TLS1.2 is enabled, work by re-enabling TLS1.1 and TLS 1.0 without changing any other settings in mailboxes etc… I was able to replicate in a standalone application that comprised of a single form and a single button. Code and error below.

However I noticed that if my visual studio project was set to .NET Framework 4.0 it would work but as soon as the standalone application was set to .NET Framework 3.5 I started to experience the error if TLS1.0 and TLS 1.1 was disabled. In both of these cases I was using the same Aspose.Mail.dll (being the 3.5 one).

Our application is .NET Framework 3.5 so we need the TLS1.2 stuff to work when the application is compiled as such.

Thanks, Julie

 Private Sub btnMain_Click(sender As Object, e As EventArgs) Handles btnMain.Click

        Dim loEmailLicence As New Global.Aspose.Email.License()

            Dim loClient As New Aspose.Email.Clients.Imap.ImapClient("imap.gmail.com", 993, "XXX@gmail.com", "XXX")
            loClient.SecurityOptions = Aspose.Email.Clients.SecurityOptions.Auto
            loClient.Timeout = 30000

            Dim loMsgs As Aspose.Email.Clients.Imap.ImapMessageInfoCollection = Nothing
            Dim loMsgsResult As System.IAsyncResult
            loMsgsResult = loClient.BeginListMessages(Nothing, Me)

            Do While Not loMsgsResult.IsCompleted
                'one small sleep for cpu...
            loMsgs = loClient.EndListMessages(loMsgsResult)

            MsgBox("Messages: " & loMsgs.Count)
        Catch ex As Exception
        End Try

    Catch ex As Exception
        MsgBox("Licence Failure!!! " & ex.ToString)
    End Try

End Sub

image.png (13.4 KB)

Thank you for the additional information. I passed it to our development team. I will inform you of any progress.

Hi @Andrey_Potapov,
Any progression with this issue?
Thanks, Julie

As I can see, the issue has been resolved. A fix will be included in Aspose.Email 21.6.

.NET Framework 3.5 did not originally support TLS 1.2. This feature was later added, but Aspose.Email checks for it by code. By code, the .NET Framework 3.5 still lacks support for TLS 1.2.

A new method will be added in Aspose.Email 21.6:

EmailClient.SetSupportedEncryptionUnsafe(EncryptionProtocols value)

This method is not safe and sets the encryption protocols without any compatibility checks.

For example, EncryptionProtocols.Tls12 considered as not supported for .NET Framework 3.5. So when you calls the code

someClient.SupportedEncryption = EncryptionProtocols.Tls | EncryptionProtocols.Tls12

only EncryptionProtocols.Tls will be used. But with Aspose.Email 21.6, you will be able to call


and TLS 1.2 will be used even with .NET Framework 3.5.

@Andrey_Potapov thank you so much this is now working.

I just wanted to get clarification on what the SetSuportedEncryptionUnsafe method will do. Will it affect SupportedEncryption?

If Supported encryption is currently TLS or TLS11, and then I add an this additional line setting TLS12 as Unsafe are the TLS11 and TLS still enabled/supported?

Thanks, Julie

I requested this information for you from our development team. I will answer you as soon as possible.

The issues you have found earlier (filed as EMAILNET-40215) have been fixed in this update.

If you want to set TLS, TLS 1.1 and TLS 1.2, you should use the code below:

someClient.SetSupportedEncryptionUnsafe(EncryptionProtocols.Tls | EncryptionProtocols.Tls11 | EncryptionProtocols.Tls12);

Method SetSupportedEncryptionUnsafe does not add more encryption protocols to the SupportedEncryption field. It sets all protocols from its argument and unsets the others.

Thanks @Andrey_Potapov, you response is very much appreciated :slight_smile: