I have problems issuing IMAP, POP3 or SMTP command
Mail.dll is a rock solid product, however most email servers don’t follow rigorously the RFC specifications. In the following few steps we’ll help you gather the information we need to make Mail.dll clients better.
If you have problems parsing a message please go here.
1.
First please check if you have the latest version installed.
2.
Please identify the command/set of commands that cause problems.
3.
Enable logging for Mail.dll clients:
// C# version: Log.Enabled = true;
' VB.NET version: Log.Enabled = True
You can observe standard Visual Studio trace output or add a custom listener to Trace.Listeners collection.

You can also enable logging using App.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="Mail.dll" value="True" />
</switches>
</system.diagnostics>
</configuration>
You can create your custom TraceListener that writes log to file:
// C# version:
internal class MyListener : TextWriterTraceListener
{
public MyListener(string fileName)
: base(fileName)
{
}
public override void Write(string message, string category)
{
if (category == "Mail.dll")
base.Write(message, category);
}
public override void WriteLine(string message, string category)
{
if (category == "Mail.dll")
base.WriteLine(message, category);
}
}
' VB.NET version Friend Class MyListener Inherits TextWriterTraceListener Public Sub New(fileName As String) MyBase.New(fileName) End Sub Public Overrides Sub Write(message As String, category As String) If category = "Mail.dll" Then MyBase.Write(message, category) End If End Sub Public Overrides Sub WriteLine(message As String, category As String) If category = "Mail.dll" Then MyBase.WriteLine(message, category) End If End Sub End Class
…then add it to Listeners collection:
// C# version: Log.Enabled = true; Trace.Listeners.Add(new MyListener(@"c:mail_log.txt")); Trace.AutoFlush = true;
' VB.NET version:
Log.Enabled = True
Trace.Listeners.Add(New MyListener("c:mail_log.txt"))
Trace.AutoFlush = True
4.
Perform the operations that cause the problems, and save the log to file.
You can remove username and password, but please do not modify the file extensively. If you do, it may be impossible to reproduce the issue.
In particular do not change new line format nor encoding.
5.
Please answer following questions:
- What exception are you getting?
- What is the exception stack trace?
- What is the exception message?
- What result you expect?
- What result are you getting?
- Which .NET Framework version are you using?
- Is it console, windows forms, windows service or web application?
- If it is possible please attach the source code you are using
6.
Finally please zip the log file and send it as attachment, along with all the answers to .
Thanks!
February 23rd, 2011 at 17:34
[...] « Send iCalendar recurring meeting requests I have problems issuing IMAP, POP3 or SMTP command [...]