{"id":1734,"date":"2011-01-05T16:51:44","date_gmt":"2011-01-05T14:51:44","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=1734"},"modified":"2024-03-11T11:29:43","modified_gmt":"2024-03-11T09:29:43","slug":"i-have-problems-issuing-imap-pop3-smtp-command","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/i-have-problems-issuing-imap-pop3-smtp-command","title":{"rendered":"I have problems issuing IMAP, POP3 or SMTP command"},"content":{"rendered":"\n<p><a href=\"\/mail\" title=\"\">Mail.dll is a rock solid product<\/a>, however most email servers don&#8217;t follow RFC specifications rigorously. In the following few steps we&#8217;ll help you gather the information we need to make Mail.dll IMAP and POP3 clients better.<\/p>\n\n\n\n<p>If you <a href=\"\/blog\/i-have-problems-parsing-the-message\">have problems parsing a message please go here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>First please check if you have the <strong>latest version<\/strong> installed. You can always download the latest version of <a href=\"\/mail\/download\">Mail.dll email component and release notes<\/a> here.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Identify command<\/h2>\n\n\n\n<p>Please identify the command\/set of commands that cause problems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Turn on logging<\/h2>\n\n\n\n<p>Enable logging for Mail.dll clients:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ C# version:\n\nLog.Enabled = true;\n\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n' VB.NET version:\n\nLog.Enabled = True\n\n<\/pre><\/div>\n\n\n<p>You can observe standard Visual Studio\u2019s trace output window (View\/Output\/Show output from: Debug) or add a custom listener to <em>Trace.Listeners<\/em> collection.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2010\/11\/Mail_Log.png\" alt=\"\" title=\"Mail.dll Log\"\/><\/figure><\/div>\n\n\n<p>You can also enable logging using <em>App.config<\/em> file:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;\n&lt;configuration&gt;\n    &lt;system.diagnostics&gt;\n      &lt;switches&gt;\n        &lt;add name=&quot;Mail.dll&quot; value=&quot;True&quot; \/&gt;\n      &lt;\/switches&gt;\n    &lt;\/system.diagnostics&gt;\n&lt;\/configuration&gt;\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">log4net<\/h2>\n\n\n\n<p>If you are using the latest version of log4net.dll, Mail.dll is going to use log4net instead of <em>Trace<\/em> class. Please refer to log4net manual on how to capture log entries.<\/p>\n\n\n\n<p>Please remember that even when using log4net, you need to enable logging by setting &#8220;Limilabs.Mail.Log.Enabled = True&#8221; or be setting <em>Mail.dll<\/em> boolean switch in App.config file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Log to file<\/h2>\n\n\n\n<p>You can create your custom <em>TraceListener <\/em>that writes log to file:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ C# version:\n\ninternal class MyListener : TextWriterTraceListener\n{\n    public MyListener(string fileName)\n        : base(fileName)\n    {\n    }\n\n    public override void Write(string message, string category)\n    {\n        if (category == \"Mail.dll\")\n            base.Write(message, category);\n    }\n\n    public override void WriteLine(string message, string category)\n    {\n        if (category == \"Mail.dll\")\n            base.WriteLine(message, category);\n    }\n}\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n' VB.NET version\n\nFriend Class MyListener\n\tInherits TextWriterTraceListener\n\tPublic Sub New(fileName As String)\n\t\tMyBase.New(fileName)\n\tEnd Sub\n\n\tPublic Overrides Sub Write(message As String, category As String)\n\t\tIf category = \"Mail.dll\" Then\n\t\t\tMyBase.Write(message, category)\n\t\tEnd If\n\tEnd Sub\n\n\tPublic Overrides Sub WriteLine(message As String, category As String)\n\t\tIf category = \"Mail.dll\" Then\n\t\t\tMyBase.WriteLine(message, category)\n\t\tEnd If\n\tEnd Sub\nEnd Class\n<\/pre><\/div>\n\n\n<p>&#8230;then add it to <em>Listeners <\/em>collection:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ C# version:\n\nLog.Enabled = true;\nTrace.Listeners.Add(new MyListener(@\"c:\/mail_log.txt\"));\nTrace.AutoFlush = true;\n\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n' VB.NET version:\n\nLog.Enabled = True\nTrace.Listeners.Add(New MyListener(\"c:\/mail_log.txt\"))\nTrace.AutoFlush = True\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Log.WriteLine<\/h2>\n\n\n\n<p><em>Log<\/em> class exposes <em>WriteLine<\/em> event. You can use that event to subscribe your own logging library:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ C#\n\nLog.WriteLine += Console.WriteLine;\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n' VB.NET\n\nLog.WriteLine += Console.WriteLine\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Reproduce the problem<\/h2>\n\n\n\n<p>Perform the operations that cause problems, and save the log to file.<br>You can remove username and password, but <strong>please do not modify the file<\/strong> extensively. If you do, it may be impossible to reproduce the issue.<br>In particular do not change new line format nor encoding.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Additional information<\/h2>\n\n\n\n<p>Please answer following questions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What <strong>exception <\/strong>are you getting?<\/li>\n\n\n\n<li>What is the exception <strong>stack trace<\/strong>?<\/li>\n\n\n\n<li>What is the exception <strong>message<\/strong>?<\/li>\n\n\n\n<li>What result you expect?<\/li>\n\n\n\n<li>What result are you getting?<\/li>\n\n\n\n<li>Which .NET Framework version are you using?<\/li>\n\n\n\n<li>Is it console, windows forms, windows service or web application?<\/li>\n\n\n\n<li>If it is possible please attach the source code you are using<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Contact Limilabs support&nbsp;<\/h2>\n\n\n\n<p>Finally please <strong>zip the log file and send it as an attachment<\/strong>, along with all the answers to: <a class=\"email\" title=\"Write to us - we're enthusiastic about support\"><\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Thank you!<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Mail.dll is a rock solid product, however most email servers don&#8217;t follow RFC specifications rigorously. In the following few steps we&#8217;ll help you gather the information we need to make Mail.dll IMAP and POP3 clients better. If you have problems parsing a message please go here. Prerequisites First please check if you have the latest [&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,28,32,42,50,57],"class_list":["post-1734","post","type-post","status-publish","format-standard","hentry","category-mail-dll","tag-c","tag-email-component","tag-imap","tag-log4net","tag-pop3","tag-smtp","tag-vb-net"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1734"}],"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=1734"}],"version-history":[{"count":14,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1734\/revisions"}],"predecessor-version":[{"id":6616,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1734\/revisions\/6616"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=1734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=1734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=1734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}