{"id":1243,"date":"2010-10-25T15:10:53","date_gmt":"2010-10-25T13:10:53","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=1243"},"modified":"2013-06-25T22:45:34","modified_gmt":"2013-06-25T20:45:34","slug":"issue-a-custom-command-to-imap-server","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/issue-a-custom-command-to-imap-server","title":{"rendered":"Issue a custom command to IMAP server"},"content":{"rendered":"<p>You can send any command to IMAP server using Mail.dll .NET IMAP component.<\/p>\n<p>In this example we will issue a standard NOOP (NO OPeration) command. This command can be used as a periodic poll for new messages. Can also be used to reset any inactivity auto-logout timer on the IMAP server.<\/p>\n<p>Of course there is a <em>Noop()<\/em> method on <em>Imap<\/em> class, but this example is about issuing any command yourself.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C# version:\r\n\r\nusing System;\r\nusing Limilabs.Mail;\r\nusing Limilabs.Client.IMAP;\r\n\r\nclass Program\r\n{\r\n    static void Main(string&#x5B;] args)\r\n    {\r\n       using (Imap imap = new Imap())\r\n       {\r\n           imap.Connect(&quot;imap.example.com&quot;);\r\n           imap.Login(&quot;user&quot;, &quot;password&quot;);\r\n\r\n           imap.SelectInbox();\r\n\r\n           ImapResponse response = imap.SendCommand(&quot;NOOP&quot;);\r\n           foreach (string line in response.Lines)\r\n           {\r\n               Console.WriteLine(line);\r\n           }\r\n\r\n           imap.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 System\r\nImports Limilabs.Mail\r\nImports Limilabs.Client.IMAP\r\n\r\n\r\nUsing imap As New Imap()\r\n\timap.Connect(&quot;imap.example.com&quot;)\r\n\timap.Login(&quot;user&quot;, &quot;password&quot;)\r\n\r\n\timap.SelectInbox()\r\n\r\n\tDim response As ImapResponse = imap.SendCommand(&quot;NOOP&quot;)\r\n\tFor Each line As String In response.Lines\r\n\t\tConsole.WriteLine(line)\r\n\tNext\r\n\r\n\timap.Close()\r\nEnd Using\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You can send any command to IMAP server using Mail.dll .NET IMAP component. In this example we will issue a standard NOOP (NO OPeration) command. This command can be used as a periodic poll for new messages. Can also be used to reset any inactivity auto-logout timer on the IMAP server. Of course there is [&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,28,77,57],"class_list":["post-1243","post","type-post","status-publish","format-standard","hentry","category-mail-dll","tag-c","tag-imap","tag-imap-component","tag-vb-net"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1243"}],"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=1243"}],"version-history":[{"count":3,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1243\/revisions"}],"predecessor-version":[{"id":4059,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1243\/revisions\/4059"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=1243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=1243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=1243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}