Reading a Directory of Emails - Problems
StatsJunkie
uclamathguy at gmail.com
Wed Jul 25 19:54:23 EDT 2007
Thanks. I tried that, but absolutely nothing is printed to the screen.
This is the code I am trying to use.
mbox = mailbox.MHMailbox("stat_inbox.mbox/Messages",email.message_from_file)
for msg in mbox:
print(msg) #just to see if anything is happening
Which mailbox type did you use? Perhaps MHMailbox in the wrong one...?
Joshua J. Kugler-2 wrote:
>
> On Tuesday 24 July 2007 09:38, Ryan Rosario wrote:
>
>> Hi,
>>
>> I have a directory that contains a bunch of email messages and I would
>> like to parse them using the email and mailbox packages. The emails were
>> exported from Apple Mail. From what I gather, I need to use MHMailbox,
>> but
>> I can't get it to do anything useful and I cannot find any examples of
>> how
>> to use this particular mailbox type.
>>
>
>>
>> I get an error. AttributeError: MHMailbox instance has no attribute
>> 'keys'. Yet this works when using PortableUnixMailbox (on an mbox file,
>> not a directory of emails).
>
> I fought with this a while back. It seems it is nested one level lower.
> You might have to get at the message by doing something like
>
> real_message = msg[0]
>
> Instead of print msg.keys(), just do a 'print msg' and see what data
> structure is returned. That will tell you a lot.
>
> j
>
> --
> Joshua Kugler
> Lead System Admin -- Senior Programmer
> http://www.eeinternet.com
> PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
View this message in context: http://www.nabble.com/Reading-a-Directory-of-Emails---Problems-tf4137576.html#a11801990
Sent from the Python - python-list mailing list archive at Nabble.com.
More information about the Python-list
mailing list