I hope the information that I shared earlier, regarding searching by Unique Id using IMAP, would be helpful for your requirements. For your queries posted in this thread, I would answer these one by one as follow. Please let us know if we can be of any additional help to you.
1. The IsSigned
method can be used to determine if it is a signed message, and the RemoveSignature() method can be used to decode the message then if it is signed.
2. MailMessage.Date represents the date when the sender wrote the email.
When the message is received by POP/IMAP server, it adds information in “Received” header like IP address and received date. The following example illustrates how to get these two dates.
MailMessage msg = MailMessage.Load(“test.eml”, MessageFormat.Eml);
Console.WriteLine("Sent date: " + msg.Date);
Console.WriteLine("Received datetime from Headers: " + msg.Headers.Get(“Received”));
3. You can extract embedded MSG attachments as follow from an email message:
static void ExtractAttachments()
MapiMessage msg = MapiMessage.FromFile("TestMsgInMsg.msg"); // This is the main message
foreach (MapiAttachment attachment in msg.Attachments)
if (attachment.ObjectData != null && attachment.ObjectData.IsOutlookMessage)
// For nested email attachments - save as msg
MapiMessage msgMessage = MapiMessage.FromStream((new MemoryStream(attachment.ObjectData.Data)));
// Interpret and save the message as MailMessage
MailMessageInterpretor mi = MailMessageInterpretorFactory
MailMessage mailMsg = mi.Interpret(msgMessage);
mailMsg.Save(Guid.NewGuid() + ".eml"),
// For other attachments
4. Aspose.Email extracts the attachments from TNEF and these are accessible to the user in the AttachmentCollection, as follow:
MailMessage mail = MailMessage.Load("Sample.eml");
foreach (Attachment att in mail.Attachments)
//Manage the attachments according to your needs
In order to extract the messages from the winmail.dat, the TNEF container must first be loaded in MailMessage and then get access to its attachments, as follow:
MailMessage eml = MailMessage.Load("multi_attachments_in_tnef.eml",
MailMessage winmail = MailMessage.LoadFromTnef(eml.Attachments.ContentStream);
foreach (Attachment att in winmail.Attachments)
5. I am afraid to inform there is no well defined method to determine the attachment as a zip archive. You can always save attachment to MemoryStream using the Attachment.Save() method.
7. Using MailMessage, Attachment.Name refers to the attachment file name and can be used to get the file name of the attachment.
8. Please refer to the following code for your requirements. It loads an EML file in MailMessage, and then attaches this MailMessage to another MailMessage for sending purpose.
//Load an EML and save it to MemoryStream
MailMessage msg = MailMessage.Load("multi_attachments_in_tnef.eml");
MemoryStream ms = new MemoryStream();
//Initialize a new MailMesssage
MailMessage msg2 = new MailMessage("email@example.com", "firstname.lastname@example.org", "Test Subject", "Test Body");
//Prepare a new Attachment from the MemoryStream
Attachment att = new Attachment(ms, "message/rfc822");
//Assign a name
att.Name = "test.eml";
//Add the attachment
//Save the message (msg2) or send it