PATH = /bin:/usr/bin:/usr/local/bin:$HOME/bin SHELL = /bin/sh # for other shells, this might need adjustment PMDIR = $HOME/.procmail # Directory for storing procmail log and rc files LOGFILE = $PMDIR/log VERBOSE=yes LOGABSTRACT=all LOCKFILE = $HOME/.pmlockfile MAILDIR=$HOME/mail LINEBUF=100000 #avoid 2048 default line buffer FORMAIL = "/usr/bin/formail" SENDMAIL = "/usr/lib/sendmail" #SUBJECT = `$FORMAIL -xSubject:` SUBJECT = `$FORMAIL -c -x Subject: \ | expand \ | sed -e 's/ */ /g' \ | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'` #FROM = `$FORMAIL -xFrom:` FROM = `egrep "^From:" | head -1 \ | formail -c -rt -xTo: \ | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'` DATE = `$FORMAIL -xDate:` MY_XLOOP = "X-Loop: $LOGNAME@$HOST" GISHELP_HOST = "gis.washington.edu" #HUMAN_EMAIL = "helptest@${GISHELP_HOST}" HUMAN_EMAIL = "phurvitz@u.washington.edu" GISHELP_EMAIL = "help@${GISHELP_HOST}" HYPERMAIL = "/usr/local/bin/hypermail" HDATE = `date +%Y.%m` YEAR = `date +%Y` MONTH = `date +%b` MON = `date +%m` DAY = `date +%d` HOUR = `date +%H` MINUTE = `date +%M` SECOND = `date +%S` INCIDENT = "$YEAR$MON$DAY$HOUR$MINUTE$SECOND" ###################################################################### # reformat all incoming mail to have the incident number # but only if this is NOT a reply :0fwh # adjust header * ! ^Subject.*R[Ee]:.* | $FORMAIL -tf \ -I To: \ -I Subject: \ -i "To: help@gis.washington.edu" \ -i "Subject: GISHELP [$SUBJECT] (Incident $INCIDENT)" \ -A "$MY_XLOOP" ###################################################################### # save all mail to backups :0wc: /home/gishelp_mailbackup ###################################################################### # hypermail it to the monthly archive :0wc | $HYPERMAIL -i -u -d /home/help/mail_archive/$HDATE \ -l "GISHELP Mail Archive: $MONTH, $YEAR" # hypermail it to the continuous archive :0wc | $HYPERMAIL -i -u -d /home/help/mail_archive/continuous \ -l "GISHELP Mail Archive Continuous" ###################################################################### # if this has no "Re:" subject, then reformat the message # send a response to the sender :0wc * ! ^Subject.*R[Ee]:.* { :0fwh # adjust header | $FORMAIL -tf \ -A "$MY_XLOOP" \ -I From: \ -I Subject: \ -i "From: GISHELP <$GISHELP_EMAIL>" \ -i "Subject: Re: GISHELP [$SUBJECT] (Incident $INCIDENT)" :0bfw # add info lines | (\ echo "|=================================================================|" ;\ echo "| Your request for help has been forwarded to the GIS helper. |" ;\ echo "| This request has been assigned incident #$INCIDENT. |" ;\ echo "| Please keep this number in the Subject of all related messages. |" ;\ echo "|=================================================================|" ;\ echo -e "\n" ;\ echo "Your original message:" ;\ echo -e "" ;\ cat | sed 's/^/> /' ; \ ) :0 #forward the response back to the user !$FROM } ###################################################################### # if this has no "Re:" subject, then reformat the message # send a notification to the human helper :0wc * ! ^Subject.*R[Ee]:.* { :0fwh # adjust header | $FORMAIL -tf \ -A "$MY_XLOOP" \ -I From: \ -I Subject: \ -i "From: GISHELP <$GISHELP_EMAIL>" \ -i "Subject: GISHELP $SUBJECT (Incident $INCIDENT)" :0bfw # add info lines | (\ echo "|==================================================================|" ;\ echo "| There is a new request for help on gis.washington.edu. |" ;\ echo "| Please log onto gis.washington.edu at your earliest convenience. |" ;\ echo "|==================================================================|" ;\ echo -e "\n" ;\ echo "Subject of message:" ;\ echo "$SUBJECT" ;\ echo -e "\n" ;\ echo -e "Client name:" ;\ echo -e "$FROM" ;\ echo -e "" ;\ echo "Original message:" ;\ cat | sed 's/^/> /' ; \ ) :0 #forward the response back to the user !$HUMAN_EMAIL } ###################################################################### # if this has no "Re:" subject, then reformat the message # send a notification to the human helper :0wc * ^Subject.*R[Ee]:.* { :0fwh # adjust header | $FORMAIL -tf \ -I From: \ -i "From: GISHELP <$GISHELP_EMAIL>" \ -A "$MY_XLOOP" :0bfw # add info lines | (\ echo "|==================================================================|" ;\ echo "| There is a follow-up request for help on gis.washington.edu. |" ;\ echo "| Please log onto gis.washington.edu at your earliest convenience. |" ;\ echo "|==================================================================|" ;\ echo -e "" ;\ echo -e "Client name:" ;\ echo -e "$FROM" ;\ echo -e "" ;\ echo -e "Original message:" ;\ cat | sed 's/^/> /' ; \ ) :0 #forward the response back to the user !$HUMAN_EMAIL } :0: * ^From:.*help@gis.* /dev/null