How can I parsing RFC822 message...

Greg Jorgensen gregj at pobox.com
Fri Sep 1 04:34:17 EDT 2000


"jun won, Seo" <linuxqna at chollian.net> wrote in message
news:8onc39$qhp$1 at news1.kornet.net...
> Hi, Python programmers !
> I'm programming web mail program..
>
> I'm success on IMAP server log on and get message header and body.
>
> How can I parsing RFC822 message.
> ...

Look at the rfc822 module, included in the typical distribution.

import rfc822
...
f = open("mailmessage")
m = rfc822.Message(f)
print m["From"]
print m["Subject"]

You will probably also want to look at the mimetools and multifile modules.

--
Greg Jorgensen
Deschooling Society
Portland, Oregon, USA
gregj at pobox.com


"jun won, Seo" <linuxqna at chollian.net> wrote in message
news:8onc39$qhp$1 at news1.kornet.net...
> Hi, Python programmers !
> I'm programming web mail program..
>
> I'm success on IMAP server log on and get message header and body.
>
> How can I parsing RFC822 message.
>
> examply---
>
> HEADER        (RFC-822) header of the message
> TEXT            MULTIPART/MIXED
> 1                  MULTIPART/ALTERNATIVE
> 1.1                TEXT/PLAIN
> 1.2                TEXT/HTML
> 2                   APPLICATION/OCTET-STREAM
> .
> .
> .
> I want get the 1's header and body, and 2's header and body.......
> I want random access Message's body...
>
> Please Help me..
>
>





More information about the Python-list mailing list