@t1jsw,
I passed your questions to our development team. Thank you for your patience.
@t1jsw,
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:
- Does the error reproduce with different accounts? Have any changes been made to the settings of these accounts?
- Is the error reproducible only on Windows Server 2019?
- Did you use Aspose.Email for .NET 3.5 or .NET 3.5 ClientProfile?
- Is the error reproducible in a standalone minimal application without your application code?
Hi @Andrey_Potapov,
-
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.
-
As well as Windows Server 2019 I can reproduce on Windows Server 2016 (14393.4350).
-
I am using .NET 3.5 not the ClientProfile one.
-
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
Try
Dim loEmailLicence As New Global.Aspose.Email.License()
loEmailLicence.SetLicense("XXXX\Aspose.Total.lic")
Try
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
loClient.SelectFolder(Aspose.Email.Clients.Imap.ImapFolderInfo.InBox)
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...
Threading.Thread.Sleep(50)
Loop
loMsgs = loClient.EndListMessages(loMsgsResult)
MsgBox("Messages: " & loMsgs.Count)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Catch ex As Exception
MsgBox("Licence Failure!!! " & ex.ToString)
End Try
End Sub
image.png (13.4 KB)
@t1jsw,
Thank you for the additional information. I passed it to our development team. I will inform you of any progress.
@t1jsw,
.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
someClient.SetSupportedEncryptionUnsafe(EncryptionProtocols.Tls12)
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
@t1jsw,
I requested this information for you from our development team. I will answer you as soon as possible.
@t1jsw,
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.