From: janwillem on 13 Apr 2010 17:54 I am trying to analyze mailboxes using an iterator: for key, message in mbox.iteritems(): When message is a simple mail message['date'] results the date. When, however, it is a multipart message this results in None. How can you full proof get the "date", "from" and "to" of of a multipart mail using python? Thanks janwillem
From: Tim Roberts on 14 Apr 2010 02:26 janwillem <jwevandijk(a)xs4all.nl> wrote: > >I am trying to analyze mailboxes using an iterator: > for key, message in mbox.iteritems(): > >When message is a simple mail message['date'] results the date. >When, however, it is a multipart message this results in None. How can >you full proof get the "date", "from" and "to" of of a multipart mail >using python? Perhaps you should post your code. There's no particular reason why you should see this. The mailbox iterator should return the outer multipart container, which has the headers. -- Tim Roberts, timr(a)probo.com Providenza & Boekelheide, Inc.
From: janwillem on 14 Apr 2010 03:45 On Apr 14, 8:26 am, Tim Roberts <t...(a)probo.com> wrote: > janwillem <jwevand...(a)xs4all.nl> wrote: > > >I am trying to analyze mailboxes using an iterator: > > for key, message in mbox.iteritems(): > > >When message is a simple mail message['date'] results the date. > >When, however, it is a multipart message this results in None. How can > >you full proof get the "date", "from" and "to" of of a multipart mail > >using python? > > Perhaps you should post your code. There's no particular reason why you > should see this. The mailbox iterator should return the outer multipart > container, which has the headers. > -- > Tim Roberts, t...(a)probo.com > Providenza & Boekelheide, Inc. Thanks Tim, There you have a point, after I find it is a multipart message I dive into it recursively and so loose the outer header info. That was all.
|
Pages: 1 Prev: Creating a standalone application Next: when should I explicitely close a file? |