MUTT_PERSONAL_RECIP exceptions based on From: field?

John A Hawkinson jhawk at
Thu Sep 20 03:06:07 UTC 2018

As I was dusting off my mutt build tree, I found the below patch, which is almost certainly wrong, but which solves an important problem for me.

Unfortunately, more and more mailing lists (Mailchimp, &c.) these days have seen fit to put one's personal address in the To: field, making it more annoying. In most cases it's feasible to change the list subscription address such that that doesn't happen, but in some cases not.

It's really annoying when such messages appear in ~p (MUTT_PERSONAL_RECIP). I find myself regularly limiting to ~p !~s foobar, to exclude that list, which is not nice.

In the case of the most annoying of these lists (and whose subscription address I cannot change and I also do not wish to unsubscribe from), list messages are identified by a variable From: field matching a pattern, e.g.:
  From: Foo Bar <forumREDACTED+d1234-s999876 at>
(This particular list is from Vanilla Forums, I think.)

The below patch, when evaluating ~p, searches the From field against the unalternates list and excludes such messages from ~p. This is obviously wrong because unalternates is supposed to be about recipient (To:/Cc:) fields, not sender (From:) fields.

But I'm not sure what the right fix should be? Maybe it should involve "lists"/"subscribe" functionality, which are not something that I really use (I have some lists in my muttrc that date from ... last century. Some still get mail.) But I think that lists (e.g. MUTT_LIST, MUTT_SUBSCRIBED_LIST: ~l, ~u) have the same general problem as MUTT_PERSONAL_RECIP, namely they only look at h->env->to and h->env->cc but not, say, env->from-mailbox.

So, what's the right way to solve this annoying problem? Is it necessary to introduce a whole additional set of RX_LISTs for matching against From: fields for lists, subscribedlists, their un- variants, and unalternates (and maybe Alterates, too, but that's unlikely)? Or to add some kind of flag extending their language to apply them to sender fields? Or... I just don't know?


--jhawk at
  John Hawkinson

--- hdrline.c.dist	2016-08-10 21:47:00.000000002 -0400
+++ hdrline.c	2016-08-30 23:09:42.000000002 -0400
@@ -185,6 +185,10 @@
 	h->recipient = 2; /* non-unique recipient */
 	h->recipient = 1; /* unique recipient */
+      if (mutt_match_rx_list(env->from->mailbox, UnAlternates)) {
+	h->recipient = 0;
+      }
     else if (user_in_addr (env->cc))
       h->recipient = 3;

More information about the Mutt-dev mailing list