mutt workflow and mail filtering

benfitzg at gmail.com benfitzg at gmail.com
Sat May 11 13:38:57 UTC 2019


On Mon, May 06, 2019 at 03:59:04PM +1000, Cameron Simpson wrote:
> On 05May2019 23:12, benfitzg at gmail.com <benfitzg at gmail.com> wrote:
> > I moved to using offlineimap to sync my gmail to a local Maildir format,
> > then I point mutt at the local filesystem.
> > This has greatly improved my mutt experience. Loading large folders is
> > far snappier.
> > 
> > I'm not that enamoured with gmail filtering,
> 
> Me either, it's rubbish.
> 
> I'll describe what I do below.
> 
> > and I'd like to be able to control
> > filtering at the Maildir level, then have offlineimap sync the changes back up
> > to the server side.
> > 
> > So a typical example might be, assuming I have no gmail filters setup and
> > everything is dumped into my INBOX.
> > 
> > - mutt mailing list email arrives at gmail into INBOX
> > - offlineimap pulls this down to my local $Maildir/INBOX/new
> > - post-sync hook runs and moves the email to $Maildir/Mutt/new
> > - offlineimap syncs back up on the server side, deleting from INBOX and writing to Mutt
> > 
> > I've used gmail as an example here but I'm also looking to implement a similar
> > solution at work where I have to use Microsoft Exchange server, which has a really
> > terrible rules interface.
> 
> Ny mail filtering is maildir based. I fetch from my ISP with getmail which
> simply delivers to my "+spool" maildir. My mail filer watches that directory
> and filters anything which lands there.
> 
> To use such a scheme for gmail I'd imagine watching the local INBOX maildir
> and filtering everything which shows up; one side effect is that INBOX would
> stop being your inbox, and something else would need to become so.
> 
> My mail filer is here:
> 
>  https://pypi.org/project/cs.app.mailfiler/

This is really interesting, I'll check it out. My main concern is the resync
back up to the IMAP server. OfflineImap keeps metadata on each mail, in the form
of a UID.

I *think* that if I were to use your mailfiler on my $Maildir, leaving
concurrent access issues aside for a moment (I'd ensure one runs after the
other), that the behaviour would be:

- run offlineimap sync, download new mail to $Maildir/INBOX
- run mailfiler against $INBOX, rules move a matching message to $Maildir/other (eg UID 1234)
- offlineimap sees the deletion of message UID 1234 and syncs this deletion back to the server
- offlineimap sees the addition of a new msg to folder other, UID 1234, syncs to the server

> which installs a "mailfiler" command along with it. I imagine there may be
> other maildir focussed filter programmes out there. Mine has simple rules
> for the simple stuff and a decent syntax for arbitrary stuff, and does a
> proper parse of the mail headers unlike procmail's regexp based approach.
> 
> Happy to go into more detail if you want it, either on my filtering flow
> (spool->spool-in->(many-places)) of the mailfiler command itself.

I'm going to try this out, but would appreciate your thoughts on the above.

Not being able to process rules locally is basically driving me insane at
work, as I have to use Exchange rules, which are just dire. Plus I cannot edit
them on the fly. Ideally I'd have a mutt macro that would take the core header
fields out the mail, append them to mailfiler rules, let me edit out what I
don't need then save and quit. In Outlook this is time consuming and brittle,
plus there is no way of seeing a log of what matches what, so undesirable
matches are hard to catch, potentially meaning I miss important mails.

I really have to fix this as it's making my working life miserable, as I'm in a
company with really, really bad email culture.

Regards,

-- 
Ben Fitzgerald


More information about the Mutt-users mailing list