Dear Lazyweb,
I was wondering if anyone here had experience with using a postfix pipe to a python program for processing mails. Most of my background in mail processing is with qmail, Perl and procmail.
From what I can tell there appears to be a ‘pipe’ command that I could use in an alias to point it at my python program, then use the ‘email.FeedParser’ class to keep it from blocking. For now I’m parsing mails from the maildir via the ‘email.Parser’ class, then moving them around. It would be very nice to process them as they come in. This would eliminate overhead from firing up python whenever I want to parse messages and make my process somewhat real time.
Any ideas/snippets/caveats are greatly appreciated!
P.S. I’m doing this in python to hook into byteflow, the django app powering this site.

Comments
Eh…after some quick hackin’ I discovered its quite simple to accomplish what I’m looking for. Still, any other suggestions or comments are welcome!
I was working on something simlar a few weeks ago:
http://blog.tplus1.com/index.php/2008/05/21/frustration-with-postfix-and-sending-email-to-a-script
So, what did you come up with? I’m not thrilled about my solution.
Anyhow, I like the giant font in this text area!
Mine too was an ugly hack and I feel dirty even mentioning bits of it.. Basically hacked it together with
man 8 pipeand slurping up stdin.Benjamin, probably not very helpful suggestion, but have you looked at what Mailman does?
Actually, that’s where I got the idea for what I did!
Comment form for «Using python with postfix pipe.»