Mass Stripping Attachments by Directory, Age, Size

Plutocrat plutocrat at gmail.com
Sat Mar 20 07:59:43 EET 2021


On 18/03/2021 16.52, Steven Varco wrote:
> 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:

I'm familiar with the Thunderbird implementation. I'd like it if the
attachment name was preserved in there too. Saving it to a directory would
be nice, but not require for my needs.

> 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. :)

I forgot to mention before, the ImapSize utility, which will help for
single accounts, for which the login and password are known.
https://broobles.com/imapsize/

But what I'm really looking for is something that I can script on a server.
I'll let you know what I come up with.

P.

On Thu, Mar 18, 2021 at 4:53 PM Steven Varco <dovecot.org at bbs.varco.ch>
wrote:

> 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 <plutocrat at gmail.com>:
> >
> > 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20210320/7fb67cdb/attachment-0001.html>


More information about the dovecot mailing list