␡
- The rfc822 Module
- A Simple DTD for E-mail
- An Example of an E-mail Message in XML
- Processing a Eudora Mailbox
- Processing a Linux Mailbox
- Processing an E-mail Message by Using the rfc822 Module
- Sending E-mail by Using xMail
- Source Code for the SendxMail Application
- Source Code for the xMail Application
This chapter is from the book
14.4 | Processing a Eudora Mailbox
The following code fragment shows the control structure required to process a Eudora mailbox into individual e-mail messages. The processing of each message has been delegated to the ProcessMessage function. This function is used by both the Linux and Eudora converters. Note how the sentinel string "From ???@???" is used to chop the contents of the mailbox into individual messages.
CD-ROM reference=14005.txt def DoEudoraMailbox(f): # f is a file object. # Chop the contents of a Eudora mailbox # into individual messages for processing # by the ProcessMessage subroutine. Message = [] L = f.readline() while L: if string.find(L,"From ???@???")!=-1: -# Full message accumulated in the Message # list, so process it to XML. ProcessMessage(Message,out) Message = [] else: # Accumulate e-mail contents line by line in # Message list. Message.append (L) L = f.readline() if Message: # Last message in the mailbox ProcessMessage(Message,out)