Variables
Here are the variables I have at the beginning of my .procmailrc. The
ones with the # are not enabled.
MAILDIR=$HOME/mail # your default mail folder (this is the default)
LOGFILE=$MAILDIR/proclog # a brief log - defining this turns logging on
SPAMFILE=$HOME/spamfile # your default spam file
#DEFAULT=$MAILDIR/other # where your mail goes if it matches nothing
#VERBOSE=ON # for debugging
-
grep the body of the message.
This one looks for the string "foofoofoo" in the body of the
message and sends it to /home/USERNAME/spamfile.
:0 B
* foofoofoo
$SPAMFILE
-
grep in the headers of the message
This one looks for the string "X-Spam-Status: Yes" in the header and
sends it to /home/USERNAME/spamfile.
:0 H
* ^X-Spam-Status: Yes
$SPAMFILE
grep'ing the headers is the default, so you can do it with or without
the "H" in the first line.
-
Email forwarding.
Forward email to me@inch.com to me@aol.com
:0
* ^TOme@inch\.com
! me@aol.com
-
Simple autoresponder.
This looks for anything from johndoe and sends the contents
of the file received_your_message.txt back to the sender. It
also quotes the contents of their message, and places the original in
your inbox folder.
:0 h c
* !^FROM_johndoe
* !^X-Loop: your@own.mail.address
| (formail -r -I"Precedence: junk" \
-A"X-Loop: your@own.mail.address" ; \
cat ~/canned_responses/recieved_your_message.txt ) | /usr/sbin/sendmail -oi -t
For other procmail recipie ideas see man procmailex.
-
Using vacation with procmail
Click here.
-
For more info
Read the man pages on procmail,procmailex,procmailrc
"man procmail", "man procmailex", "man procmailrc".