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 of Mail.dll installed. You can always download the latest version of Mail.dll email component and check release notes here.
Identify UID
Please identify unique id (UID) of the message you are having problems with.
Download email
Next step is to download entire email message and save it as a raw eml file.
Note that you should not parse the email, so there is no need to use MailBuilder and IMail classes.
Download using IMAP protocol
// C# code
long uid = 12345;
using (Imap imap = new Imap())
{
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.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
Download using POP3 protocol
// C# code
string uid = "12345";
using (Pop3 pop3 = new Pop3())
{
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.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 do 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
Contact Limilabs support
Finally please zip the eml file and send it as a attachment (possibly zipped), along with all the answers to: .
April 2nd, 2016 at 15:34
[…] us « I have problems parsing the message Unique ID in IMAP protocol […]