# (send | get) help # (send | get) info(rmation)? # # Author: Alan K. Stebbens # # Check for any of the commands :0 * ? test -f commands.rc.log { OLDCMDLOGFILE=$LOGFILE LOGFILE=commands.rc.log LOGABSTRACT=all VERBOSE=yes } :0 * ^Subject: *\/\ ((send|get) +(help|info(rmation)?|\ procmailrc|\ (procmail|smartlist) *(- *)?info(rmation)?|\ (procmail|smartlist) *(- *)?lib(rary)?|\ emacs(-| *)setup|\ pgp *key)|\ (en|dis)able +(auto *)?ack(nowledge?ment)?s?) * ! ^FROM_DAEMON * $ ! ^X-Loop: $MY_ADDR { # We're forking at this point -- so shutup procmail COMSAT=off # Tell sendmail we've got control DELIVERED=yes # Save a copy just in case (in log mode) :0 c: * LOGFILE ?? commands\.rc\.log commands.requests # Get the trigger subject SUBJ=$MATCH # Get the best reply address (used for logging) :0 * ! ^Reply-to: *\/[^ ].* * ! ^From: *\/[^ ].* * ! ^Sender: *\/[^ ].* * ! ^From *\/[^ ]+ { FROM=nobody } :0E { FROM=$MATCH } # Just in case these aren't defined FROMSIG="${FROMSIG:-\"The Mailer-Daemon of $USER\" <$USER>}" MY_ADDR="${MY_ADDR:-<$USER>}" # The log file COMMANDLOG=${COMMANDLOG:-commands.log} # The basic processing works like this: # Now that we've captured the important information from the # incoming mail, we replace the headers portion with an # autoreply header. # # Then, as part of recognizing the SUBJECT command, we # replace the body portion with the response # # After testing for all the possible subject commands, # we then submit the mail unless it is empty. # Generate a reply header, and replace the headers :0 fhw | formail -rI"From: $FROMSIG" \ -I"Reply-To: $MY_ADDR" \ -I"Subject: Re: $SUBJ" \ -I"X-Loop: $MY_ADDR" # Now, start a new message body # :0 fbw # | echo "This message was sent automatically in reponse to your recent" ; \ # echo "mail with the subject: \"$SUBJ\"." ; \ # echo "" # Now process each command ##### send information :0 E * SUBJ ?? info(rmation)? { # The information file with a suitable default INFOFILE=${INFOFILE:-commands.info} REPLYFILE=$INFOFILE INCLUDERC=comm-reply-file.rc }