Sorting / filtering before reading with mutt
Rene Kita
mail at rkta.de
Sun Oct 5 14:40:24 UTC 2025
On Sun, Oct 05, 2025 at 02:16:10PM +0000, Pietido wrote:
>
> Dear Mutt-users,
>
> maybe my request was answered more than one time from you,
> but I did not find out how I can sort e-mails before I read them with
> mutt.
>
> I use mbsync to receive my e-mails for an IMAP account
> provider and to read it offline with mutt.
>
> Maybe there is a way to setup procmail or a similar app to filter
> e-mail?
I call fdm after I synced with mbsync to filter some email in my Inbox.
I also use mlist from mblaze to check if there is new mail. This all
happens in a script.
.fdm.conf looks like this:
#v+
$mail = "%h/Mail"
account "filter" maildir "${mail}/Inbox"
action "spam" maildir "${mail}/Spam"
# Bob Idiot
match case "^From: Some Idiot <idiot at example\.com>" in headers action drop
# spam
match case "^X-Original-To: info at rkta\.de" in headers action "spam"
#v-
And here is my script:
#v+
#!/bin/sh
mbsync default || exit 10
rsync -a --delete ~/Mail/ ~/.Mail.backup/ || exit 9
fdm fetch || exit 8
mlist -N ~/Mail/Inbox | read _
#v-
I usually have mutt put in the background and call the scripts as
$ ms && %1
So, if I have new mail mutt will be put in the foreground. You get the
idea.
More information about the Mutt-users
mailing list