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

Free Support Forum - aspose.com

Extracting date from eml file

I am trying to extract the metadata from given eml file. The date property of mailmessage class is actually a message sent date, or received date ?? There is only a date property, there not much detail info about message create date, sent date or received date ? I need to extract all these dates as meta from Email file. Can you please help ??

@alishasharma,

Can you please share source file so that we may further investigate to help you out.

Please, find the file [here ](https://drive.google.com/open?id=1JtvYYE7W_L-DByYmqV_up90x4m-j8F-O)
I am expecting to extract all the dates information from eml file like email sent date, received date, created date. But,I am not seeing such property. When I load emlfile with MailMessageClass, I get only one date, and I don’t know which date actually it is. can you please me ?

@alishasharma,

Can you please grant me access to files which you shared with us. Also please visit this thread link as well. This will help you to achieve your requirements.

@Adnan.Ahmad,

I tried code present in the thread link you provided. Can we use Date from MailMessage object as EmailSentDate? Actually, we have used another API for extracting eml information. Now that we are shifting to Aspose, while comparing the SentDate, ReceivedDate fields, we are observing value differences in so many cases, So We are confused as which property should we use to extract the EMAILSENTDATE AND EMAILRECEIVEDATE. Is EmailReceivedDate is always present ? Can you please help us to provide some reasons that the values extracted by Aspose are correct, indeed.

@alishasharma,

Can you please share source file along with sample project so that we may further investigate to help you out.

Can you please go through [this ](https://drive.google.com/file/d/1vtPbn5s5cSDywhItYqcuZPIwyGkMdUlW/view?usp=sharing) file.
I am getting received date earlier than it was sent.
Sent date: 3:21:54 PM
Received Date = 3:18:16 PM I am using the following code for extraction.
MapiConversionOptions options = new MapiConversionOptions();
options.PreserveOriginalDates = true;
MapiMessage msg = MapiMessage.FromMailMessage(message, options);
bool isUnicodeMsg = msg.MessageFormat == OutlookMessageFormat.Unicode ? true : false;
var mapiProperties = msg.Properties;
MapiProperty prop = null;
prop = mapiProperties[MapiPropertyTag.PR_CLIENT_SUBMIT_TIME];
if (prop != null)
this.SentDate = prop.GetDateTime();
prop = mapiProperties[MapiPropertyTag.PR_MESSAGE_DELIVERY_TIME];
if (prop != null)
this.RecievedDate = prop.GetDateTime();
Can you please help?

@alishasharma,

I have worked with sample file shared by you using Aspose.Email for .NET 20.2 and have not been able to observe the issue. Can you please try using the specified version and also observe the output shared by me.
image.png (93.5 KB)

Can you please try the same using 18.1 version of aspose.email , so that I can be sure that we are having those issues because of only aspose version. We have been trying so hard to fix these issues. Can you please help ?

@alishasharma,

I suggest you to please try using Aspose.Email for .NET 20.2 as we have not been able to observe any issue with latest version. Even if it is an issue in Aspose.Email for .NET 18.1 the latest version is unable to reproduce the issue.