Reading Outlook .msg file using Python

John Henry john106henry at hotmail.com
Tue Oct 12 17:59:24 CEST 2010


On Oct 11, 8:54 am, Tim Golden <m... at timgolden.me.uk> wrote:
> On 11/10/2010 4:39 PM, John Henry wrote:
>
> > I am trying your code but when it get to the line:
>
> >>     mapi.MAPIInitialize ((mapi.MAPI_INIT_VERSION, 0))
>
> > I got the error message:
>
> > Either there is no default mail client or the current mail client
> > cannot fulfill the messsage requrest.  Please run Microsoft
> > Outlook ... client.
>
> > I have Outlook (not Express - Outlook 2002) running and I did set it
> > to be the default mail client.  Does MAPI works with Exchange only?
>
> No. I was running it with Outlook 2003 installed (not running,
> in fact, although it is the default mail client on that machine).
>
> > (And why do I need MAPI to read the file?)
>
> Basically because the MAPI subsystem already contains all
> the code to interpret that particular format of structured
> storage. If you can find some source of info which tells
> you how to parse the format directly, then you can sidestep
> MAPI. Presumably this is what is done by the Java code you
> mentioned.
>
> I'm afraid I'm not at work at the moment, and I don't run
> Outlook on this machine. (So I can't even save an .msg file
> to test). FWIW the code did run successfully on my work
> machine and produced the plain text of the email, so it
> is just a configuration sort of issue. If no-one chips
> in with a suggestion in a few hours, might be worth
> posting to python-win32; there might be people there who
> don't watch this (higher-traffic) list.
>
> I have a vague memory that when I set this kind of thing
> up to run on our Helpdesk server where I use this to
> ingest incoming emails I did have to install a sort
> of server-only alternative to Outlook. I'll try to remote
> into the server later to see if I can spot it. But that
> still wouldn't explain what the problem was if you were
> actually running Outlook in any case.
>
> TJG

According to:

http://support.microsoft.com/kb/813745

I need to reset my Outlook registry keys.  Unfortunately, I don't have
my Office Install CD with me.  This would have to wait.

Thanks,



More information about the Python-list mailing list