memeller / shrunked

Shrunked Image Resizer add-on for Thunderbird
https://addons.thunderbird.net/addon/shrunked-image-resizer/
12 stars 0 forks source link

Idea: Shrunk imeages in existing emails #16

Open zimcad opened 10 months ago

zimcad commented 10 months ago

First, thanks a lot for this fork!

Customers often send emails with very big images to me, that i dont need in this resolution. Is there a chance to implement a way to reduce those images in an existing email manually?

Betterbird commented 10 months ago

Drive-by comment: The add-on is for composition, it manipulates images embedded or attached to messages being composed.

Images in received mails sit in some multipart/mixed, multipart/related or sometimes erroneously multipart/alternative MIME part of the message. Since TB has no API to replace message parts, the add-on would have to replace the entire message (while deleting the existing one) and replace that MIME part in the meantime.

There are add-ons which do this sort of thing, like "Header Tools Lite" or "Header Tools Improved" which replace messages after having changed message headers or the content of a body part.

memeller commented 7 months ago

@Betterbird is right - there is no API that would allow message body modification. I think that the reason for this is quite simple - the content of emails should not be modified on the server, other than adding headers / changing the subject to e.g. mark them as spam. However, it is possible to achieve the desired effect of manipulating email content by using some tricks. There is a great extension called EditEmailSubject-MX that enables you to edit the subject. The author has come up with a clever way to add a new email to the same folder as the original, but with modified content. Using his method and my quickly written (and probably not always working) parser, I was able to get a poc for this feature.

Unfortunately, I cannot guarantee that my parser will work for all emails. There is a chance that an email may become corrupted / lost due to an incompatibility between my parser and the email client from which the email originated. So I am not sure if such a feature should be added to the main release. Perhaps if I added some warnings at various stages of the resizing process and always kept a copy of the original email locally (as EditEmailSubject-MX does)?\ Testing\ Since xpi files are not supported here, please change the extension from .zip to .xpi after downloading. The extension has a different id and name, so that it can be installed along the main release. shrunked v5.8 alpha.zip