I have problems parsing the message

Mail.dll is a rock solid product, however most emails don’t follow RFC specifications rigorously. 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.

Prerequisites

First please check if you have the latest version installed. You can always download the latest version of Mail.dll email component and release notes here.

Identify UID

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

Download

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 protocol

// C# code

long uid = 12345;

using (Imap imap = new Imap())
{
    imap.Connect("imap.example.com");    // or imap.ConnectSSL("imap.example.com");
    imap.UseBestLogin("user", "password");
    imap.SelectInbox();

    byte[] eml = imap.GetMessageByUID(uid);
    string fileName = string.Format(@"c:\email_{0}.eml", uid);
    File.WriteAllBytes(fileName, eml);

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

Dim uid As Long = 12345

Using imap As New Imap()
	imap.Connect("imap.example.com")     ' or imap.ConnectSSL("imap.example.com")
	imap.UseBestLogin("user", "password")
	imap.SelectInbox()

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

	imap.Close()
End Using

POP3 protocol

// C# code

string uid = "12345";

using (Pop3 pop3 = new Pop3())
{
    pop3.Connect("pop3.example.com");    // or pop3.ConnectSSL("pop3.example.com"); 
    pop3.UseBestLogin("user", "password");

    byte[] eml = pop3.GetMessageByUID(uid));
    string fileName = string.Format(@"c:\email_{0}.eml", uid);
    File.WriteAllBytes(fileName, eml);

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

Dim uid As String = "12345"

Using pop3 As New Pop3()
	pop3.Connect("pop3.example.com")	' or pop3.ConnectSSL("pop3.example.com")
	pop3.UseBestLogin("user", "password")

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

	pop3.Close()
End Using

Additional information

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

Sending

Finally please zip the eml file and send it as a attachment (possibly zipped), along with all the answers to
.

Thank you!

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 […]

Questions?

Consider using our Q&A forum for asking any questions.