[Mailman-Users] procmail before mailman- closer!
washakie at gmail.com
Sat Jun 14 10:11:39 CEST 2008
Well, I finally gave up and renamed the list! It is working now. However, I'm
having another challenge. I'm trying to create a filter that will accept
messages with a specific combination of user/subject/attachment type and
then execute the attachment as a python file. But it seems the file is
actually getting executed twice - I guess because when it is 'read' by
procmail, it is actually run... is this correct? Below is my method, could
someone help explain how to avoid running the attachment twice?
Here is how I achieve this:
1) procmail filters initiate a python script call:
| echo "Job received at " `date` >> /home/username/jobs;
2) python script checks the mail:
import sys,datetime, os
import subprocess as sub
from email import Parser
""" RUN A BASH CMD """
p = sub.call(cmd, shell=True)
dbg = file('/home/username/debug','w')
dbg.write('Trying to parse file at: %s\n' % now)
for part in msg.walk():
dbg.write('found multipart :: \n')
dbg.write("Partname == %s\n" % name)
# grab the logfile
cmd = "python %s" % pyFile
dbg.write("file: %s contains:\n %s \n\nFinished at: %s\n" %
View this message in context: http://www.nabble.com/procmail-before-mailman-tp17789754p17836952.html
Sent from the Mailman - Users mailing list archive at Nabble.com.
More information about the Mailman-Users