{"id":1257,"date":"2010-10-25T15:27:58","date_gmt":"2010-10-25T13:27:58","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=1257"},"modified":"2012-06-03T15:53:37","modified_gmt":"2012-06-03T13:53:37","slug":"delete-emails-with-pop3","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/delete-emails-with-pop3","title":{"rendered":"Delete emails with POP3"},"content":{"rendered":"<p>This article describes how to <strong>delete email messages<\/strong> using Mail.dll <a href=\"\/mail\">.NET POP3 component<\/a> and POP3 protocol.<\/p>\n<p>Internally deleted messages are only marked for deletion. Email messages are actually deleted by POP3 server after the client issues successful QUIT command &#8211; in other words: when client disconnects.<\/p>\n<p>Following code will find unique ids of all messages and <strong>delete them one by one<\/strong>.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C# version\r\n\r\nusing Limilabs.Client.POP3;\r\n\r\nclass Program\r\n{\r\n    static void Main(string&#x5B;] args)\r\n    {\r\n        using (Pop3 pop3 = new Pop3())\r\n        {\r\n            pop3.Connect(&quot;pop3.company.com&quot;);    \/\/ use ConnectSSL for SSL.\r\n            pop3.Login(&quot;user&quot;, &quot;password&quot;);\r\n\r\n            \/\/ Delete all messages\r\n            foreach (string uid in pop3.GetAll())\r\n            {\r\n                pop3.DeleteMessageByUID(uid);\r\n            }\r\n\r\n            pop3.Close();\r\n        }\r\n    }\r\n};\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET version\r\n\r\nImports Limilabs.Client.POP3\r\n\r\nPublic Module Module1\r\n    Public Sub Main(ByVal args As String())\r\n\r\n        Using pop3 As New Pop3()\r\n            pop3.Connect(&quot;pop3.company.com&quot;)  ' use ConnectSSL for SSL.\r\n            pop3.Login(&quot;user&quot;, &quot;password&quot;)\r\n\r\n            ' Delete all messages\r\n            For Each uid As String In pop3.GetAll()\r\n                pop3.DeleteMessageByUID(uid)\r\n            Next\r\n\r\n            pop3.Close()\r\n        End Using\r\n\r\n    End Sub\r\nEnd Module\r\n<\/pre>\n<p>Here you can find <a href=\"\/blog\/gmail-pop3-behavior\">Gmail POP3 behavior regarding downloading and deleting email messages<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article describes how to delete email messages using Mail.dll .NET POP3 component and POP3 protocol. Internally deleted messages are only marked for deletion. Email messages are actually deleted by POP3 server after the client issues successful QUIT command &#8211; in other words: when client disconnects. Following code will find unique ids of all messages [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[15,33,42,57],"class_list":["post-1257","post","type-post","status-publish","format-standard","hentry","category-mail-dll","tag-c","tag-email-component","tag-pop3","tag-vb-net"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1257"}],"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=1257"}],"version-history":[{"count":3,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1257\/revisions"}],"predecessor-version":[{"id":3099,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1257\/revisions\/3099"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=1257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=1257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=1257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}