Procmail recipe

Ed Blackman ed at
Sat Jan 24 16:33:21 CET 2009

On Sat, Jan 24, 2009 at 09:52:56AM +0100, Xavier Maillard wrote:
>I am trying to have a "general" recipe to do something based on
>the X-BeenThere header.
>Say I have a header like this one:
>X-BeenThere: lolica at
>I want procmail to "automagically" store any messages to this
>list into

Untested, but something like this should work.

LISTNAME=`formail -x X-BeenThere | awk listname.awk`

* ^X-BeenThere: .*

listname.awk is attached below.

-------------- next part --------------

# Input: a string formatted like an email address on standard input
# Output: the address segments reversed, dot separated, with '.lists' appended
# Example: "procmail at lists.RWTH-Aachen.DE" becomes "DE.RWTH-Aachen.lists.procmail.lists"

# Example Use: formail -x X-BeenThere | awk listname.awk 

# split each line on at-symbol and dot

  # iterate over fields in reverse order
  for (i=NF; i>0; i--) {
    # remove whitespace

    # print field with trailing dot

    # append "lists" after last field
    if(i == NR) printf("lists");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.txt
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <>

More information about the procmail mailing list