Using the Envelope "From" Address [INCOMPLETE] So rather than try to match any and all of the various places mailing lists can put indications in the headers, what I do is use a special feature of some MTAs to distinguish between emails that go to the same user. This is typically done by appending "+whatever" to the username; it is ignored by the MTA, apart from passing it along. What I do is I subscribe user+mlist-foo@mydomain.com to the mailing list foo, and then I sort anything to that user into that mailbox. In order for this to all work properly, a number of things must happen. 1) I use postfix as my MTA with "recipient_delimiter = +" 2) I configure postfix to use Maildir format mailboxes 3) Configure postfix to use procmail as the local delivery agent: mailbox_command = /usr/local/bin/procmail -t -a "$EXTENSION" -a "$USER" -a "$DOMAIN" -a "$LOCAL" This passes a bunch of handy values to procmail, which can then pass them to your procmailrc. Note that if you rely on .forward, then none of this information is available. 4) In your .procmailrc, use something like this: PATH=/bin:/usr/bin:/usr/local/bin MAILDIR=$HOME/Maildir LOGFILE=$HOME/.maillog DEFAULT=$MAILDIR/inbox/ # NB: Must be called from postfix not .forward to get this # .forward takes precedence EXTENSION="$1" USER="$2" DOMAIN="$3" LOCAL="$4" :0c $HOME/.mbox :0 fhw | formail -u X-Original-To :0 fhw | formail -R X-Label Old-X-Label :0 fhw | formail -R X-Original-To X-Label INCLUDERC=$HOME/.procmailrc.mlists 5) In your muttrc, do something like this: set editor=muttedit set attribution="Sent-To: %y\nOn %d, %n wrote:" 6) The muttedit script should look something like: #! /bin/sh if test "$#" != 1 then echo "Usage: ${0##*/} filename" >&2 exit 1 fi editfile="$1" shift # Create a temporary filename so we can do some judo. tmpfile=$(mktemp -t "muttedit.XXXXXXXXXX") # Now parse out the Sent-To line; the value of this field is our desired # identity. NEW_FROM_ADDR=$(sed -ne '/^Sent-To: /,0s/^Sent-To: //p' "$editfile") cp "$editfile" ~/tmp/foo # If a Sent-To line was supplied to us, then we need to do something clever. if test -n "$NEW_FROM_ADDR" then # Now, do the replacement and get rid of the Sent-To line. sed -e "s/^From: \\(.*\\)<\\(.*\\)>/From: \\1<$NEW_FROM_ADDR>/" "$editfile" > "$tmpfile" awk -v blanks=0 -- 'blanks >= 2 { print; }; /^$/ { blanks++; }; blanks == 1 && /^Sent-To: / { blanks++; print ""; }; blanks == 0 { print; }' "$tmpfile" > "$editfile" fi # Now edit it as normal. exec ${MUTT_EDITOR:-${VISUAL:-${EDITOR:-vi}}} "$editfile" 7) To make ~/.procmailrc.mlists, I use ~/.mlists as a source file that lists my +mbox extensions and the related mailing lists, one per line, like so: ml-satlug satlug Then I have a program like this which makes the ~/.procmailrc.mlists: $ cat ~/bin/mkmlists #! /bin/sh # Reads $HOME/.mlists and uses that to write procmail rules # for filtering to mailboxes based on RECIPIENT. exec < $HOME/.mlists > $HOME/.procmailrc.mlists echo '# Autogenerated by mkmlists from $HOME/.mlists' while read ext folder do mkmd $folder || continue echo echo ":0" echo '* ? test "$EXTENSION" = "'$ext'"' echo "$folder/" done mailboxes The mailboxes script just creates the "mailboxes" entries in my mutt config files: $ cat ~/bin/mailboxes #! /bin/sh export spoolfile=$HOME/Maildir/ echo '# Autogenerated by $HOME/bin/mailboxes' > $HOME/.mutt/mailboxes (find $spoolfile -mindepth 1 -type d \! -name '.*' -print | (while read d; do for s in cur new tmp; do test -d "$d/$s" || continue 2; done; echo "mailboxes =${d##$spoolfile}"; done) | sort) >> $HOME/.mutt/mailboxes