Reading e-mail body (newbie)

Kalle Svensson kalle at gnupung.net
Tue Mar 27 08:12:30 EST 2001


Sez Jacobus van der Merwe:
> Hi,
> 
> I have a script to which e-mail to a certain address is relayed.
> 
> I need to write the body of the e-mail to a file.
> 
> I use
> 
> rfc822.Message(sys.stdin)
> 
> to read the e-mail, but I can't figure out how to access the body.
> It seems that rfc822 only have methods to access the headers. ????

Read from rfcobj.fp, I think:

rfcobj = rfc822.Message(sys.stdin)
body = rfcobj.fp.read()

Peace,
  Kalle
-- 
Email: kalle at gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
 [ Not signed due to lossage.  Blame Microsoft Outlook Express. ]




More information about the Python-list mailing list