Email package and mailbox module

Chris Keyes chrisk at nipltd.com
Fri Jan 17 12:01:22 EST 2003


The line I was trying to figure out was:

mbox = mailbox.UnixMailbox(infile,email.message_from_file)

Simple when you realise that Python does the call for you :-)

I believe the word is "Doh!"

Thanks for the pointers guys :-)

Chris Keyes wrote:
> Hi All
> 
> I'm a bit new here so if I've missed any relevant posts please point me 
> to them :-)
> 
> I'm currently trying to extract email messages from a mailbox file 
> (mailbox module does this fine as long as running on unix).
> 
> I want both the body and the headers (basically to index the contents of 
> the message). The RFC822 module will give me the headers and (I think) a 
> file type object which is the body (or is it a string)?  msg.fp.read()
> 
> But from what I can see the Email module would me a much much better way 
> of getting at the contents of the message. I'm just not really sure how 
> it works and how to mesh to two together.
> 
> Does anyone know of any good examples I may be able to have a good peer 
> at? The factory type object thing kinda confused me. I've really only 
> done scripting in python rather than 'propper' coding, so any help here 
> would be much appreciated.
> 
> I should also add that I no longer work for NIP but they have kindly 
> provided me with a spam protected inbox while I'm finishing my degree. 
> This project is the start of my final year project (a mailing list 
> archive).
> 
> Many thanks for your help on this one, you never know I may get back 
> into this stuff enough to be able to answer the odd question on here one 
> day ;-)
> 
> Cheers
> 
> ChrisK
> 





More information about the Python-list mailing list