I have problems parsing the message

Mail.dll is a rock solid product, however most of the emails 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 parser better.

If you have problems issuing IMAP, POP3, or SMTP command please go here.

1.
First please check if you have the latest version installed.

2.
Please identify unique id (UID) of the message you are having problems with.

3.
Next step is to download entire message and save it as raw eml file.
Note that you should not parse the email, so there is no need to use MailBuilder and IMail classes.

IMAP version:

// C# code

long uid = 12345;

using (Imap imap = new Imap())
{
    imap.Connect("server");
    // imap.ConnectSSL("server"); // if you need SSL connection.
    imap.UseBestLogin("user", "password");
    imap.SelectInbox();

    string eml = imap.GetMessageByUID(uid);
    string fileName = string.Format(@"c:\email_{0}.eml", uid);
    File.WriteAllText(fileName, eml, Encoding.UTF8);

    imap.Close();
}
' VB.NET code

Dim uid As Long = 12345

Using imap As New Imap()
	imap.Connect("server")
	' imap.ConnectSSL("server") ' if you need SSL connection.
	imap.UseBestLogin("user", "password")
	imap.SelectInbox()

	Dim eml As String = imap.GetMessageByUID(uid)
	Dim fileName As String = String.Format("c:\email_{0}.eml", uid)
	File.WriteAllText(fileName, eml, Encoding.UTF8)

	imap.Close()
End Using

POP3 version:

// C# code

string uid = "12345";

using (Pop3 pop3 = new Pop3())
{
    pop3.Connect("server");
    // pop3.ConnectSSL("server"); // if you need SSL connection.
    pop3.Login("user", "password");

    string eml = pop3.GetMessageByUID(uid));
    string fileName = string.Format(@"c:\email_{0}.eml", uid);
    File.WriteAllText(fileName, eml, Encoding.UTF8);

    pop3.Close();
}
' VB.NET code

Dim uid As String = "12345"

Using pop3 As New Pop3()
	pop3.Connect("server")
	' pop3.ConnectSSL("server"); ' if you need SSL connection.
	pop3.Login("user", "password")

	Dim eml As String = pop3.GetMessageByUID(uid)
	Dim fileName As String = String.Format("c:\email_{0}.eml", uid)
	File.WriteAllText(fileName, eml, Encoding.UTF8)

	pop3.Close()
End Using

4.
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

5.
Finally please zip the eml file and send it as attachment, along with all the answers to
.

Thanks!

Tags: , , , , , ,

One Response to “I have problems parsing the message”

  1. I have problems issuing IMAP, POP3 or SMTP command | Blog | Limilabs Says:

    [...] us « I have problems parsing the message Unique ID in IMAP protocol [...]

Leave a Reply