{"id":5511,"date":"2019-07-02T12:39:36","date_gmt":"2019-07-02T10:39:36","guid":{"rendered":"https:\/\/www.limilabs.com\/blog\/?p=5511"},"modified":"2023-08-07T13:50:34","modified_gmt":"2023-08-07T11:50:34","slug":"use-tls12-with-pop3","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/use-tls12-with-pop3","title":{"rendered":"Using TLS 1.2 with .NET POP3 client"},"content":{"rendered":"\n<p>This article presents a comprehensive tutorial that elaborates on how to configure the <a href=\"https:\/\/www.limilabs.com\/mail\">Mail.dll POP3 client<\/a> for seamless integration with the TLS 1.2 encryption protocol.<\/p>\n\n\n\n<p>This security enhancement ensures that receiving emails via POP3 remain safeguarded against potential threats and unauthorized access.<\/p>\n\n\n\n<p>By default clients and POP3 servers negotiate SSL\/TLS versions they can both use. Most systems don&#8217;t allow SSL 3.0, TLS 1.0, 1.1 anymore and Mail.dll POP3 component simply uses the most recent TLS version.<\/p>\n\n\n\n<p>TLS 1.2 and 1.3 are the most secure versions of TLS protocols. It is easy to force the connection to use it. <\/p>\n\n\n\n<p>All you need to do is to set <em>Pop3.SSLConfiguration.EnabledSslProtocols<\/em> property to <em>SslProtocols.Tls12<\/em> before issuing <code>ConnectSSL<\/code> or <code>Connect<\/code> and <code>StartTLS<\/code> sequence:<\/p>\n\n\n\n<div class=\"well\">Here you can <a href=\"\/blog\/use-ssl-with-pop3\">learn more on how TLS\/SSL and STLS work in POP3 protocol<\/a><\/div>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ C#\n\nusing (Pop3 pop3 = new Pop3())\n{\n    pop3.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;\n\n    pop3.ConnectSSL(\"pop.example.com\");\n\n    pop3.UseBestLogin(\"user\",\"password\");\n\n    \/\/ ... \n\n    pop3.Close();\n}\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n' VB .NET\n\nUsing pop3 As New Pop3()\n\tpop3.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12\n\n\tpop3.ConnectSSL(\"pop.example.com\")\n\n\tpop3.UseBestLogin(\"user@example.com\", \"password\")\n\n\t'...\n\n\tpop3.Close()\nEnd Using\n<\/pre><\/div>\n\n\n<p>For <a href=\"\/blog\/ssl-vs-tls-vs-starttls-stls\">explicit SSL\/TLS<\/a>, code is almost the same. You first connect to a default, non-secure POP3 port and secure the connection using <code>Pop3.StartTLS<\/code> method:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ C#\n\nusing (Pop3 pop3 = new Pop3())\n{\n    pop3.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;\n\n    pop3.Connect(\"pop.example.com\");\n    pop3.StartTLS();\n\n    pop3.UseBestLogin(\"user@example.com\",\"password\");\n\n    \/\/ ... \n\n    pop3.Close();\n}\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n' VB.NET\n\nUsing pop3 As New Pop3()\n\tpop3.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12\n\n\tpop3.Connect(\"pop.example.com\")\n\tpop3.StartTLS()\n\n\tpop3.UseBestLogin(\"user@example.com\", \"password\")\n\n\t'...\n\n\tpop3.Close()\nEnd Using\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Older .NET framework versions<\/h2>\n\n\n\n<p>To use TLS 1.2 in POP3 client at least .NET Framework 4.5+ must be installed on your machine and your application should target .NET 4.5+.<\/p>\n\n\n\n<p>It is possible to use TLS 1.2 in applications targeting earlier .NET framework versions, but 4.5 must be installed on the machine. After you have .NET 4.5 installed, your 2.0 &#8211; 4.0 apps will use the 4.5 System.dll and you can enable TLS 1.2 using this code:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ C#\n\npop3.SSLConfiguration.EnabledSslProtocols = \n    (SecurityProtocolType)3072;\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>This article presents a comprehensive tutorial that elaborates on how to configure the Mail.dll POP3 client for seamless integration with the TLS 1.2 encryption protocol. This security enhancement ensures that receiving emails via POP3 remain safeguarded against potential threats and unauthorized access. By default clients and POP3 servers negotiate SSL\/TLS versions they can both use. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[42,53,83,114],"class_list":["post-5511","post","type-post","status-publish","format-standard","hentry","category-mail-dll","tag-pop3","tag-ssl","tag-tls","tag-tls-1-2"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/5511"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=5511"}],"version-history":[{"count":7,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/5511\/revisions"}],"predecessor-version":[{"id":6525,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/5511\/revisions\/6525"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=5511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=5511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=5511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}