A sample .procmailrc rules file


# (c) 1996 Fred Morris, m3047@halcyon.com. All rights reserved.

# Very important to set the shell to csh at Halcyon...

SHELL=/bin/csh

# Catch all mail sent to the "cookie"

:0
* ^TOfredm3047
* !^Subject:.*I-ACK
{
    # Return a copy to the sender..

    :0 h c w
    * !^FROM_DAEMON
    * !^X-Loop: m3047@halcyon.com
    | ( formail -r -A"X-Loop: m3047@halcyon.com"    \
                   -I"From: fredm3047@halcyon.com" ;\
        cat cookie-note.txt ) | $SENDMAIL -oi -t

    # Strip it to just the headers and two lines of the body

    :0 f b w
    | head -2
}

# Add a header line to known mailing lists

:0 f
* ^To:.*MEME
| formail -A"X-Mail-List: MEME"

:0 f
* ^TOwednet|^FROMwednet
| formail -A"X-Mail-List: WEDNET"

:0 f
* ^To.*slime
| formail -A"X-Mail-List: SLIME"

# If something's not addressed to me and not a list, headers only,
# save a copy on Halcyon.

:0
* !^TO.*m3047
* !^X-Mail-List:
{
    :0 c:
    ./mail/junk-mail

    :0 f h w
    | formail -A"X-Junk-Mail: Yes"

    :0 f b w
    | echo "junk"
}



back to the Procmail Guide