<<< Date Index >>>     <<< Thread Index >>>

Re: a little comparison of procmail and maildrop



* Allister MacLeod <amacleod@xxxxxxxx> [2003-10-31 10:59 -0500]:
> :0
> * ^TO_freebsd-questions@freebsd\.org
> $LISTDIR/fbsd-q+n/

Note that this approack will turn up false positives (mail sent to list
but also Cc:ed to you) and false negatives (if someone Bcc:s the list).
It's probably better to match on email headers specific to the list.  My
collection of procmail rules includes:

  # most lists - RFC2919 and some variants.
  :0 fhw
  * ^((List-Id|X-(Mailing-)?List):(.*[<]\/[^>@\.]*))
  | formail -I "X-List-Classify: $MATCH"
  
  # Majordomo
  :0 fhw
  * ^Sender: owner-[^@]+@[^@\+]+
  * ^Sender: owner-\/[^@\+]+
  | formail -I "X-List-Classify: $MATCH"
  
  # yahoogroups
  :0 fhw
  * ^Mailing-List: list \/[^@]+
  | formail -I "X-List-Classify: $MATCH"
  
  # ezmlm
  :0
  * ^Mailing-List: contact \/[^@\+]+
  {
      LISTID=`echo $MATCH | sed -e 's/-help$//'`
  
      :0 fhw
      | formail -I "X-List-Classify: $LISTID"
  }

(Then I have a rule later on that grabs X-List-Classify and actually
handles the mail.)

> I'm sure there's a procmailish way to do your other thing about
> unmangling subject lines.

I've only been half paying attention to this thread, but does this do it?

  :0
  * ^X-List-Classify: \/.*
  {
      # [...]
      
      :0 fhw
      | sed -e "s/^\\(Subject:.*\\)\\[$MATCH\\]\\( \\)*/\\1/I"

      # [...]
  }

Thus, for a list named "mutt-users", it removes any "[mutt-users]" from
the subject line.  (Case insensitive, so it also catches mailman's
preferred "[Mutt-users]".)

-- 
...computer contrarian of the first order... / http://aperiodic.net/phil/
PGP: 026A27F2  print: D200 5BDB FC4B B24A 9248  9F7A 4322 2D22 026A 27F2
--- --
UNIX was half a billion (500000000) seconds old on Tue Nov 5 00:53:20 1985
GMT (measuring since the time(2) epoch).
                       -- Andy Tannenbaum
---- --- --