We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Network DLL msg file

Hi

We are evaluating the Aspose.Network dll for a SharePoint solutions for one of our customers
We want to read the Received date from a msg file
Witch date field is this:
http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/aspose.network.mail.mailmessage.date.html

witch other fields can one read from the msg file

Best Regards


This message was posted using Email2Forum by ShL77.

Hi,

Thanks for considering Aspose.

MailMessage.Date shows the sent date.
This date which is set by smtp server can be accessed from header as below:

MailMessage eml = MailMessage.Load(“test.msg”, MessageFormat.Msg);
Console.WriteLine(“Received datetime from Headers: " + eml.Headers.Get(“Received”));

When it is received by Outlook, it adds creation time, which can be accessed as below:
MapiMessage msg = MapiMessage.FromFile(test.msg”);
MapiProperty propCreationDate = msg.Properties[MapiPropertyTag.PR_CREATION_TIME];
Console.WriteLine("Msg creation date: " + propCreationDate.GetDateTime().ToString());

Msg file can be loaded via both MailMessage and MapiMessage classes.

MailMessage: General class for loading email messages of type eml, msg or mhtml. This class is used throughout other Aspose.Network classes e.g. SmtpClient (to send emails), Pop3Client.Fetch() (to download message from pop3 server), etc. Most common properties related to the email can be accessed e.g. sender, to, cc, bcc, subject, body, attachments etc. For details, please visit http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/aspose.network.mail.mailmessage.html.

MapiMessage: For loading outlook msg files. If you want to access properties that are specific to msg file format e.g. Outlook Mapi properties or rtf, please use this class. For more details, please visit http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/aspose.network.outlook.mapimessage.html.

Some articles are also covered related to managing eml or msg files.