cypht icon indicating copy to clipboard operation
cypht copied to clipboard

Delete attachments but keep email

Open NasserNgandu opened this issue 1 year ago • 1 comments

Delete attachments but keep emails. Here is the link of the task: https://avan.tech/item60587. I added a delete button that allows you to delete an attached file if it exists on the server. delete_attachment

NasserNgandu avatar Aug 12 '22 17:08 NasserNgandu

@NasserNgandu Just to be sure (I didn't test)

  • This needs to be optional (default off)
  • There should be a confirmation message when deleting an attachment (to avoid accidents)

marclaporte avatar Aug 12 '22 18:08 marclaporte

@marclaporte. There is already a confirmation message, I can just make it optional.

NasserNgandu avatar Aug 13 '22 08:08 NasserNgandu

@NasserNgandu : no need to make the confirmation message optional. This is a rare operation, and it makes sense that the user always confirms.

marclaporte avatar Aug 13 '22 08:08 marclaporte

@marclaporte. Alright, I leave it like that.

NasserNgandu avatar Aug 15 '22 12:08 NasserNgandu

This is not functionally correct I'm afraid (I like the idea and appreciate the work), however attachments are only stored on the web server when attaching them to outgoing E-mail. Attachments on messages you have in your IMAP account and stored in the IMAP server. To remove an attachment requires the following steps:

  • read in the entire message and parse the MIME structure
  • identify the portion of the message that represents the attachment to delete
  • save a new message with all other parts except the deleted part
  • delete the original message

jasonmunro avatar Aug 22 '22 19:08 jasonmunro

"save a new message with all other parts except the deleted part" -> And not change the date so the sort order remains as before

marclaporte avatar Aug 22 '22 20:08 marclaporte

@marclaporte @jasonmunro. Could you enlighten me on how to save a new message without touching the timestamp. I did a search and couldn't find a way to do this.

NasserNgandu avatar Aug 29 '22 11:08 NasserNgandu

@marclaporte @jasonmunro. Could you enlighten me on how to save a new message without touching the timestamp. I did a search and couldn't find a way to do this.

You cannot. E-mail messages have a date header, this you should maintain from the original E-mail. However IMAP servers manage a created timestamp (commonly referred to as "arrival time") and you cannot change that.

jasonmunro avatar Aug 30 '22 17:08 jasonmunro

I did not look thoroughly at the RFC but it would be great if we could keep at least some header or an "empty space" at the original place.

If that is entirely impossible, then we shall save the original timestamp e.g. as a (potentially hidden) tag with a predefined prefix to be able to search & find & sort the mails according to the original order which for myself is very important.

Half a year ago I was quickly scripting something using curl and IMAP and I remember some hacky things like issuing COPY to a temporary folder to preserve time and other attributes. IDK but maybe this could be somehow combined with sieve filtering during the "COPY" to the special temporary folder.

dumblob avatar Sep 02 '22 12:09 dumblob