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

Free Support Forum - aspose.com

Date of EML attachments are not preserved after saving file(.eml) using Aspose.Email

Hi,

We are trying to preserve the Original dates of attachments inside an Email file with .eml file extension.(This is happening for all .eml files with attachments. generated from aspose.email)
But we are unable to find an option to do the same. this is causing all attachments to be saved as new files (saved with current time as created and modified dates) every time they are downloaded from .eml file (using save-as option against the attachment in Microsoft outlook)

But, We could find an option for .msg files using the below option:
MsgSaveOptions options = new MsgSaveOptions(MailMessageSaveType.OutlookMessageFormatUnicode);
options.setPreserveOriginalDates(true);

Can you please help us with information how we can achieve the same for “.eml” files?

Note: We owe “Aspose.Email for Java” license and currently running on 19.2 version, we tried to find if latest version of the same library has this capability but could not find the same on 22.2 Aspose.Email

Looking forward to hear from you !
Thanks in Advance

@manods

We have logged a ticket to add PreserveOriginalDates property in EmlSaveOptions class as EMAILJAVA-35032 in our issue tracking system. We will inform you via this forum thread once this feature is available.

Could you please attach the following resources here for testing:

  • Your input file.
  • Please attach the output file that shows the undesired behavior.
  • Please attach the expected output file that shows the desired behavior.
  • Please create a sample Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi @tahir.manzoor,

Attached the sample .eml output that shows the behavior I’m talking about.
test.zip (103.3 KB)

How to reproduce info:

  1. Extract the zip file and store the .eml file in some local location
  2. Open the eml file in Microsoft Outlook (as per our usage), save the attachment available under the eml to local directory using “save as” option.
  3. Once the attachment is saved to local, open the attachment properties and check for the “created date”, “modified date” and “accessed date”.

These dates are supposed to be:
Created: ‎03 ‎February ‎2022, ‏‎6.52.38 PM
Modified: ‎16 ‎March ‎2022, ‏‎11.31.35 AM
Accessed: When the attachment is saved to local disk

but they are coming like:
Created: ‎When the attachment is saved to local disk
Modified: ‎When the attachment is saved to local disk
Accessed: When the attachment is saved to local disk

I’m afraid I won’t be able to provide the application code here, I would suggest an easy way to reproduce this.

Send/Receive an email to/from with attachment and convert that .msg file to eml file using your aspose msg-eml-online-converter.

This produces the same behavior.

Could you please attach your input EML that contains the attachment? It is difficult to say what the problem is without EML and code. Thanks for your cooperation.

4 posts were split to a new topic: Date of EML attachments are not preserved after saving file

@manods

The EML attachment contains a Content-Disposition header. The Content-Disposition header contains properties like:

Creation-Date 
Modification-Date 
Read-Date

Example:

----_=_NextPart1583_0ef17597-d724-49e4-b323-0a55f4da10f4 Content-Type: application/octet-stream; name="nature-wallpapers-38-610x381.jpg" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="nature-wallpapers-38-610x381.jpg" Creation-Date="Tue, 15 Mar 2022 12:30:00 GMT"; Modification-Date="Wed, 16 Mar 2022 12:30:00 GMT"

  1. Your EML file does not contain any Date properties for the attachment.
  2. If the EML contains properties like Creation-Date/Modification-Date, Outlook does not use it with “save as” option.

Can your please provide an EML sample file that is processed by Outlook you expect?