Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong sent date when parsing mail #534

Open
Faelean opened this issue Jun 10, 2024 · 3 comments
Open

Wrong sent date when parsing mail #534

Faelean opened this issue Jun 10, 2024 · 3 comments

Comments

@Faelean
Copy link

Faelean commented Jun 10, 2024

I've found a strange case where the sent date when looking at the Email Object is different than the one Outlook shows.

String msgFileName = ".\\assets_sjm\\test.msg";

try (FileInputStream fileInputStream = new FileInputStream(msgFileName)) {
    Email email = EmailConverter.outlookMsgToEmail(fileInputStream);
    System.out.println("Sent Date: " + email.getSentDate());
}

Sent Date: Mon Jun 10 08:46:28 CEST 2024
When I open the file in Outlook the sent date is 04.06.2024 15:31

The strange thing for me is that only one customer is able to produce these kind of mails, I haven't manage to create one myself.

The mail is exported from Outlook via Drag&Drop to our software, which then shows the sent date as the exact time when the mail was exported. This behaviour persists when downloading the file from their instance and then uploading it into another instance.
If I download the mail and open it in Outlook the correct sent date is displayed. When I drag the file on to Outlook the mail is sorted with the expected sent date, if I export it again from my Outlook and put in our software the correct date is shown and running the example from above the output is
Sent Date: Tue Jun 04 15:31:19 CEST 2024

test.zip

@bbottema
Copy link
Owner

bbottema commented Jun 10, 2024

I had a quick look how this field is populated right now:

builder.fixingSentDate(ofNullable(outlookMessage.getClientSubmitTime())
	.orElse(outlookMessage.getDate())); // TODO creation date?

I'm not sure this is correct. Probably not, considering your bug and the TODO question...

@Faelean
Copy link
Author

Faelean commented Jul 11, 2024

Hi, do you have an update on this bug?

@bbottema
Copy link
Owner

bbottema commented Jul 14, 2024

No, but a quick Google search tells it might need to be the delivery-time as well, which is apparently what the Outlook client uses according to some sources. So add that to the gamut of options :/

  • ClientSubmitTime
  • Date
  • CreationDate
  • DeliveryTime

Which could translate into something like this:

builder.fixingSentDate(ofNullable(outlookMessage.getClientSubmitTime())
    .orElse(ofNullable(outlookMessage.getDeliveryTime())
    .orElse(ofNullable(outlookMessage.getDate())
    .orElse(outlookMessage.getCreationDate()))));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants