facebooktwittermenuarrow-up

GemBox Support Forum

Is there a way to set the TLS version to be used when making an IMAP connection?

I am using Gembox to get email from an Outlook 365 mailbox via IMAP to parse. Microsoft has starting moving to use TLS 1.2 exclusively and this has resulted in a bunch of errors on my end, both sending email via SMTP (not using Gembox) and parsing this one mailbox. The first issue I addressed by setting the security protocol explicitly.

System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol Or SecurityProtocolType.Tls12

But I’m having trouble connecting via IMAP because I can’t figure out how to specify the TLS version for Gembox to use. Is that even possible?

Thanks.

Hi,

GemBox.Email uses SslStream so TLS 1.2 should be used.

Can you try updating the .NET Framework on your machine?
Also, can you try updating your application’s targeted framework version?

Regards,
Mario

No, that’s kind of the root cause of the issue, I know. The project uses .NET 4.5 and updating it right now might be complicated. I was hoping there might be a setting in Gembox where we could specify the security protocol, but I guess no luck?

Hi Lazar,

We have added an ImapClient.Connect(SslProtocols) overload method that should achieve your requirement.

Please try using that method with this latest bugfix:
https://www.gemboxsoftware.com/email/nightlybuilds/GBE15v1094.zip

Or this latest NuGet package:
Install-Package GemBox.Email -Version 15.0.1094-hotfix

Does this solve your issue?

Regards,
Mario

Is this not a stable feature yet, or am I doing something wrong? Because that documentation link you posted doesn’t contain anything about the overload method, but I found it in google cache anyway.

I’ve replaced the files in the Bin with the ones from the nightly you posted, rebuilt the website, but I still get “Too many arguments to ‘Public Overloads Sub Connect()’”

This is the code I used:

            Const Tls12 As SslProtocols = DirectCast(&HC00, SslProtocols)
            imap.Connect(Tls12)

So either I didn’t update to the new version right, or it’s not supported with that build yet.

Thank you for your help.

I believe that is because your browser is showing you a cached version, try pressing CTRL + F5 to execute hard reload.

That won’t work because when you build the project the “bin” folder’s content will be replaced.
How exactly have you added reference to GemBox.Email?
Are you using it as a package, private assembly, or shared assembly from GAC?

In any case, try removing the reference to GemBox.Email, then place the new DLL file that I provided in the previous message inside your project, then add a reference to that DLL file.

Does this solve your issue?

Regards,
Mario

Yes, I’d apparently screwed up the package install, so I managed to properly remove and replace it with the new version.

All looks good and we haven’t had an issue in almost a week. Thank you very much for your help!