looking for command-pipe performance advice

jason-dated-af27661e5bfe243d at mastaler.com jason-dated-af27661e5bfe243d at mastaler.com
Thu Apr 5 19:45:12 EDT 2001


Can anyone suggest a more efficient, and/or higher performance method
of reading in a mail message as standard input, and then feeding the
message to a command pipe (qmail in my case).

I do need to examine the mail headers, but don't need to look at the
message body at all.

Here is what I'm doing currently:

--------------------------------------------------------------------

import os, rfc822, cStringIO

raw_message = sys.stdin.read()       
message = cStringIO.StringIO(raw_message)
headers = rfc822.Message(message)    

# header examination and processing deleted

inject_message = os.popen('/var/qmail/bin/qmail-inject','w')
inject_message.write(raw_message)
inject_message.close()

--------------------------------------------------------------------

Thanks.

-- 
My e-mail address represents an experiment in SPAM reduction.
For more information, see <URL:http://jason.mastaler.com/tms>




More information about the Python-list mailing list