Danamir / imap-attachment-extractor

IMAP attachment exporter, with optional Thunderbird detach mode
11 stars 4 forks source link

Some clients show replaced message with current timestamp #8

Closed tschloss closed 1 year ago

tschloss commented 1 year ago

Hi, I have a second issue:

After altering a message with the tool, Apple Mail (macOS) shows the message with the current time, not the original timestamp. Same problem with the webmail frontend of the provider Strato.

Mailmate does not show this wrong date.

When inspecting the source of the mail in the webmail frontend I could NOT find any time field which is altered. So I am not sure if somebody stores metadata besides the source text of a message?

I do not have this behavior when I remove attachments with Mailmate or Apple Mail. Not sure if these applications have another mechanism than "delete & append"?

Any ideas?

Thomas

tschloss commented 1 year ago

Hi, I think I have the solution to this issue, but haven't vompleted the code change.

In line 582 I find the call to imap.append. The third parameter is meant to be date/time but is called with an empty value (I assume current date/time is added somewhere automatically). I tried to put imaplib.Time2Internaldat(XXXXX) in there. Using the epoch timestamp (hardcoded for the test) as a number here solved the problem. I wasn't sure where to take the date from programmatically. But the function Time2Internaldat seems to be pretty flexible to take strings or epoch. Also not sure about any timezone handling. Maybe you could complete this?

Thank you Thomas

Danamir commented 1 year ago

Hi,

I don't have access to a macOS to test any solution, and in Thunderbird the replacement mail appears at the correct date. But if your solution is easy enough to implement I could do a patch, I'll look if I can find the correct date in the source email.

Cheers,

Danamir commented 1 year ago

I added the mail date parameter to imap.append, by using the local timezone. It should be ok.

tschloss commented 1 year ago

Thank you, that is great. I tested one example and it worked!

This tool is so well equipped with options - but without maintaining te date I could not use it.

Thank you!!