mail filtering question

Tim Chase blinux.list at thechases.com
Sun Aug 31 01:05:52 UTC 2014


On August 30, 2014, Jude DaShiell wrote:
> could formail be used to go through email messages in an archive
> and delete all of the images from all of those messages in that
> archive? 

How are the emails stored?  In mbox format, Maildir, or MH?  Those are
the most popular 3 on a Linux box.  Maildir is the easiest & safest
to work with as each message is in its own file and it's popularly
supported.  MH format is also one-message-per-file but doesn't have
quite the same popularity (and thus support) as Maildir.  The mbox
format is classic, but it's easily corrupted since it has multiple
messages in a single file.

> other command line tool do this kind of email filtering?

I don't know of any existing command-line tool to do such, but I'd be
glad to throw together a quick Python script that could discard
various attachments by mime-type, so you could purge image/gif and
image/jpeg.  Of course, I'd test it, but you'd want to make a backup
in case something goes wrong and it drinks your beer, steals your
truck, drives over your dog, and runs off with your wife.

Also, if your local mail-store gets synced from an IMAP server, it
might notice that the files have changed and then proceed to
restore them with their attachments.

-tim





More information about the Blinux-list mailing list