[Tutor] python email forwarder via postfix
cyresse at gmail.com
Wed Nov 10 14:49:13 CET 2004
Just poke around email.Parser, it's a standard library.
Here's some code of mine -
for msgnum in range(len(names)):
f = email.Parser.Parser()
msg = f.parsestr(msgdata)
That should get you a parsed RFC 822 compliant email.
To parse from a file as opposed to a string, you just use
msg = f.parse(msgdata)
On Tue, 9 Nov 2004 22:35:49 -0500, xcentric at unixgeek.net
<xcentric at unixgeek.net> wrote:
> Hi there,
> I'm posting this here, because I'm a bit green and I'd prefer not to reinvent
> the wheel if possible. Can someone please point me in the right direction on
> parsing emails w/ Python? My goal is to read in an email that is piped in
> from postfix and then forward the message (whole) based an arbitrary system.
> Tutor maillist - Tutor at python.org
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.
More information about the Tutor