Hardware Reference
In-Depth Information
This requires that the sender is steev 5 and that the subject is “light on” before it runs the heyu command to
control the light. Both conditions must be met. You can, and should, extend these arguments to include the full e-mail
address (to prevent any steev from having control over the light) and perhaps a regular expression to make the subject
line case insensitive. But before we continue, I'll break down those elements.
Each recipe consists of three parts:
u Mode : This is generally :0 but can also include instructions for locking (so that the recipe
cannot be run multiple times simultaneously) by appending another colon, with the name of a
lock file (for example, :0:mylock ).
u Conditions : Zero or more lines (beginning with an asterisk) indicating how the e-mail
must appear for processing to occur. This also supports regular expressions. Because every
condition must be satisfied in an AND logical fashion, you can accept all mail by not including
any condition lines.
u Action : The final line indicates whether the message should be forwarded to another e-mail
account (with ! forwarded@othermail.com ), passed to a script or program ( | command arguments ),
or merely copied to a file (the name of the file, without prefix characters). To support multiple
actions, you will need to perform some heavy magic (involving multiple recipes, :0c modes, or
branch handling; see http://partmaps.org/era/procmail/mini-faq.html#recipe-block for
more information).
Each recipe is evaluated in order until it finds one that fulfills all conditions, at which point it stops. You can verify
the input to Procmail by using the formail tool as part of the action in a catchall recipe:
:0
|formail >> ~steev/procmail-log
You can review this in real time by opening a separate terminal window, typing the following, and watching the
mail messages appear:
tail -f ~steev/procmail-log
You can also use this technique when debugging Procmail-invoked scripts by taking a copy of a sent e-mail
and redirecting it to the script's input. You can also debug Procmail scripts by using the LOGFILE directive. Here's an
example:
LOGFILE=$HOME/procmail.logfile
The .procmailrc script itself also has some of the functionality of a standard bash script, so you can also prepare
the PATH variables for the commands and preprocess the mail to extract the subject line, like this:
PATH=/usr/bin:/usr/local/bin:/usr/local/minerva/bin
SUBJECT=`formail -zxSubject:`
N Some installations also require you to create a .forward file containing the single line "|/usr/bin/procmail"
(with quotes) in order to trigger Procmail. This is when Procmail is not your local mail delivery agent.
Note
/BVIOUSLYADAPTTHISTOTHEEMAILADDRESSYOUWILLBEUSINGTOTEST
 
Search WWH ::




Custom Search