I have been trying to get python scripts working from my procmailrc
I am running procmail 3.22 on IRIX 6.5, invoking procmail
from my .forward.
the following recipe works when I send mail locally (bypassing sendmail)
:0 w
* Subject:.*PYTHON
|python -c1
procmail: Match on "Subject:.*PYTHON"
procmail: Executing "python,-c1"
procmail: Program failure (1) of "python"
procmail: Assigning "LASTFOLDER=python -c1"
when mail is delivered via sendmail. I guess this might be some kind
of permission problem (since the pyton interpreter is in my home dir),
but I have not been able to track it down. Otherwise I think the environment
should be the same, since I am _not_ invoking procmail with the -p option.
Are there other variables I can sent to get more feedback on what is
happening with the exec process? Other common mistakes?
here is my .forward
"|/usr/people/wiss/bremner/bin/procmail #bremner"
my procmailrc is a bit big, but I guess 10K is ok, so here it is:
#
#
# SET VARIABLES
# Internal Variables
SHELL=/bin/sh #Shell used to run procmail. Be sure this points to
#your system's copy of sh. DO NOT substitute a
#different shell unless you really know UNIX
LINEBUF=4096 #Needed to keep Procmail from choking on long
#"recipes", or instructions on what to do with
#particular kinds of email.
PATH=$HOME/bin:/bin:/usr/bin:/usr/bsd:/usr/sbin:/usr/freeware/bin
#Path for your programs -- this is probably best
#left alone.
# for python
LD_LIBRARY_PATH=/rbg/local/lib:${HOME}/lib
VERBOSE=off #Change this to "on" when you try a new recipe
#so that Procmail will log literally every step
#it takes. DO NOT LEAVE IT ON, though, because
#it creates huge logfiles.
# Default Program & file locations
MAILDIR=${HOME}/spool #you'd better make sure this directory exists
SPOOLDIR=${HOME}/spool
BACKDIR=${SPOOLDIR}/backup
DEFAULT="/var/mail/bremner" #Your default incoming mailbox. Change
"yourlogin"
#to your login name.
ADMINFOLDER=${SPOOLDIR}/admin #for bounced mail, mail from root,
#postmaster, abuse, etc. Change this to
#${DEFAULT} if you use
#Eudora, Pegasus Mail, Netscape, Internet
#Explorer, or another Windows- or Mac-based
#POP email program.
BULKFOLDER=${SPOOLDIR}/bulk #for bulk mail which appears legitimate, such
#as mail from mailing lists or mail sent
using
#Bcc: Change this to ${DEFAULT} if you use
#Eudora, Pegasus Mail, Netscape, Internet
#Explorer, or another Windows- or Mac-based
#POP email program.
SENTMAIL=${SPOOLDIR}/sent-mail
LOGFILE=${HOME}/log/procmail.log #Logs message disposition. Recommended
-- otherwise
#errors are emailed to you. :/
FORMAIL=/usr/people/wiss/bremner/bin/formail #Needed for autoreply recipes.
Modify this to
#your system's copy of formail.
SENDMAIL=/usr/lib/sendmail #useful for autoreply recipes. Modify this to
point
#to your system's copy of sendmail.
TMDA_FILTER=${HOME}/bin/tmda-filter
# Ackmail settings
ACKMSG=${HOME}/.ackmsg
FROMSIG="bremner(_at_)mathematik(_dot_)tu-muenchen(_dot_)de"
ACKMAILRC=${HOME}/lib/procmail/stebbens/ackmail.rc
MY_NAMES="bremner(_at_)ma"
MY_ADDR="bremner(_at_)mathematik(_dot_)tu-muenchen(_dot_)de"
# SpamBouncer settings
#
# You can ignore these if you aren't installing the SpamBouncer.
# If you are installing the SpamBouncer, PLEASE BE SURE TO READ
# the installation instructions at <http://www.spambouncer.org/>.
ALTFROM=bremner(_at_)attglobal(_dot_)net #An alternate email address which
doesn't
#show your normal email address, so that
#spammers don't get your usual email
address
#from complaints. (Some spammers will
mailbomb
#you or otherwise cause trouble.)
#I recommend opening a free email
#account at Yahoo or somewhere else and
#checking it occasionally to be sure
nothing
#you want is sent there.
BLOCKFOLDER=${SPOOLDIR}/block #for suspicious mail, but possibly not spam
BLOCKREPLY=SILENT #SILENT tells the SpamBouncer to just
filter
#blocked email, and not reply to it.
#NOTIFY tells the SpamBouncer to tell the
#sender that his/her email was blocked, and
#tells them how to bypass the filter if
their
#email is legitimate.
BYPASSWD=polytope #Password that allows people who send you
#legitimate email, but whose email is
#blocked for some reason by the Spam
Bouncer,
#to bypass the SpamBouncer.
FREEMAIL=INTERNAL #Tells the SpamBouncer whether to filter
#email from sites which offer free email
#addresses, and which list to use.
MYEMAIL=${HOME}/.myemail #Tells the SpamBouncer all email addresses
that
#belong to you. Useful for distinguishing
personal
#from bulk email.
NOBOUNCE=${HOME}/.nobounce #Tells the SpamBouncer where your NOBOUNCE
#file is located.
NOLOOP=${ALTFROM} #Setting for email address used in X-Loop:
#header, a header which should prevent
#mailing loops. Leave this alone unless
#you know what you're doing.
PATTERNMATCHING=SILENT #Enables the SpamBouncer's Pattern Matching
#filter. NONE disables the filter; SILENT
#causes it to filter out suspected spam
#but not notify the senders; NOTIFY causes
it
#to both filter out suspected spam and
notify
#the sender exactly as for other blocked
email.
SBDIR=${HOME}/lib/procmail/spambounce #Directory where SpamBouncer program
files
#are located. Edit this to point to that
#directory on your system.
SPAMFOLDER=${MAILDIR}/spam #change this to SPAMFOLDER=/dev/null
#to delete spam entirely.
SPAMREPLY=SILENT #SILENT tells the SpamBouncer to filter
spam,
#but not attempt to autocomplain about it.
#BOUNCE tells the SpamBouncer to send a
#"MAILER-DAEMON" bounce message to the
spammer.
#COMPLAIN tells the SpamBouncer to send an
#autocomplaint to the spammer's postmaster
and
#upstream sites. BOTH tells the
SpamBouncer to
#send both a bounce to the sender and
complain
#to the spammer's postmaster.
# BEGIN RECIPES
:0 w
* Subject:.*PYTHON
|python -c1
# Create a backup cache of 100 most recent messages in case of mistakes
:0 c
${BACKDIR}
:0 ic
| cd ${BACKDIR} && rm -f dummy `ls -t msg.* | sed -e 1,100d`
# Regenerate "From" lines to make sure they are valid
:0 fhw
| ${FORMAIL} -I "From " -a "From "
# MAILING LISTS
# Filter out mail from all mailing lists you are on =before= spam
# filtering. I included two I subscribe to and recommend highly, but
# your list will doubtless be different. Just duplicate the recipe
# for each mailing list you are on, and put the correct address for
# the list in the condition statement. (The "* ^TO" part.)
:0:
* ^TO(ipaq|jornada)@handhelds\.org
| ${FORMAIL} -A"X-Folder: ipaq" >>${SPOOLDIR}/ipaq
:0:
* ^TO(fcs.*-l|unbf-.*faculty-g)@.*unb\.ca
| ${FORMAIL} -A"X-Folder: unb" >>${SPOOLDIR}/unb
:0:
* ^TOprocmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
| ${FORMAIL} -A"X-Folder: procmail" >>${SPOOLDIR}/procmail
:0:
* ? test -f ${MYEMAIL} && \
(${FORMAIL} -zxFrom: |\
fgrep -i -f ${MYEMAIL})
| ${FORMAIL} -A"X-Folder: sent-mail" >> ${SENTMAIL}
# known deadbeats.
:0:
* ^FROM.*tradersunite.com
/dev/null
:0:
* ^FROM.*offersdirect.us
/dev/null
:0:
* ^FROM(_dot_)*(_at_)boss(_dot_)com
/dev/null
:0:
* ^FROM.*artmarket.com
/dev/null
:0:
* ^FROM.*levelogic.com
/dev/null
# Call the SpamBouncer to filter remaining mail for spam. Comment out
# the first INCLUDERC below and uncomment the second if you are using
# the beta test version of the SpamBouncer.
#INCLUDERC=${SBDIR}/sb.rc
#INCLUDERC=${SBDIR}/sb-new.rc
#INCLUDERC=${ACKMAILRC}
# Sort out mail that really is to you from mail Bcc'd to you, or mail
# which doesn't have any of your email addresses on the To: or Cc: line.
# For this to work properly, you must create a text file named .myemail
# in your home directory and enter all email addresses that belong to
# you in it, one per line, just as you do with your .nobounce file.
#
# This does =wonders= in keeping spam from appearing in your personal
# mail. :)
#
# Substitute your shell account email address, custom domain, and any other
email
# address you may have for the entries below.
# TMDA setup
# Set the necessary environment variables.
EXTENSION=`python ${HOME}/bin/extension.py`
:0
* EXTENSION ?? .
{
DELIMITER="+"
}
RECIPIENT="$LOGNAME$DELIMITER$EXTENSION(_at_)$HOST"
SENDER=`formail -zrxTo`
:0 w
* Subject:.*TMDA
|mycat
:0:
* ? test -f ${MYEMAIL} && \
(${FORMAIL} -zxTo: -zxCc: |\
fgrep -i -f ${MYEMAIL})
| ${FORMAIL} -A"X-Folder: Default" >> ${DEFAULT}
# Deliver email which passed spam filtering, but which wasn't sent to
# a recognizable personal email address of yours, to your "bulk mail"
# folder, for reading on a less-urgent basis.
:0:
| ${FORMAIL} -A"X-Folder: Bulk" >>${BULKFOLDER}
# Done :)
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail