I would like such a feature too, but instead of deleting the atatchment files,
I would like to „detach“ the files and save them into a sperate directory,
which could be on a different storage like a share in the users home directory
or even S3 and then replace the attachment in the Mail with a LINK to that file.
Thunderbird does this quite well with its „Detach Attachment“ feature; the MIME
part looks like this after that:
————————————————————————————————————————
Content-Type: image/png;
name="funny-picture.png"
Content-Disposition: attachment; filename="funny-picture.png"
X-Mozilla-External-Attachment-URL:
file://///fileserver/home/svarco/mail/attachments/funny-picture.png
X-Mozilla-Altered: AttachmentDetached; date="Thu Mar 18 09:44:37 2021"
You deleted an attachment from this message. The original MIME headers for the
attachment were:
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename=funny-picture.png
Content-Type: image/png;
name="funny-picture.png"
————————————————————————————————————————
I know that for MS Exchange / Outlook some external archiving solutions as
components do exist and looking for something similar to offload attachments
with dovecot. :)
Steven
--
https://steven.varco.ch/
> Am 18.03.2021 um 08:31 schrieb Plutocrat <[email protected]>:
>
> Hi,
>
> I've been looking around for a solution to this problem. I want to prune down
> the attachments on a server before a migration. Some of the emails are 7
> years old and have 40Mb attachments, so this seems like a good opportunity to
> rationalize things. So perhaps I'd like to "Remove all attachments from
> emails older than 2 years, in the .Sent directory", or "Attachments over 10Mb
> anywhere in the mail tree"
>
> I've found the strip_attachments.pl script here
> <https://fossies.org/linux/Mail-Box/examples/strip-attachments.pl> which
> works fine on mbox (as tested on my local Thunderbird mboxes), but not on
> maildir which is on the dovecot server. My Perl isn't strong enough to
> re-purpose it.
>
> I've looked at ripmime and mpack/munpack, and although they seem like useful
> tools to do the job of deconstructing the mail into its constituent parts, it
> doesn't seem to help in re-building the email. I think they could be used
> with a bit of study into mail MIME structure, and used with a helper script.
>
> So before I take a deep dive into scripting my own solution, I just wanted to
> check if anyone else on the list has been through this and has some resources
> or pointers they can share, or maybe even someone to tell me "Duh, you can do
> it with doveadm of course".
>
> P.