Fun with Outlook and MAPI

Steve Holden steve at
Mon Dec 13 21:28:58 CET 2004

Chris wrote:

>> There is actually a workaround. You're using Simple MAPI which has a 
>> nice easy interface. The confirmation dialogs are only for Simple 
>> MAPI. Using Extended MAPI can work around the problem but its a lot 
>> more tricky.
>> See the initial discussion here: 
>> This code has now been included in pywin32 somehow but I can't 
>> remember where and its late. Should also be a cookbook entry. Maybe 
>> Google can help :-)
> Okay, here's the results.  The good news is that the code sent the mail 
> without any popup's.  The bad news is that the sent e-mail stays in the 
> outbox instead of the sent folder.  Any suggestions?
> Chris

Well, only the same one I've already made, which is to look on the 
win32all mailing list archives. Since this appears to be beyond you, 
here's a note by Chad Stryker commenting on an original work by David 

It may give you the clues you need, otherwise Google for the whole 

"""Thank you for figuring this extended MAPI interface all out.  I 
discovered a couple of problems with the code (on my system at least). 
First, the message in my outbox was marked as read.  Second, the message 
would remain in the outbox after it was sent.  After several hours of 
work, I added three lines to the function that mark the message as 
unread and cause the message to be deleted from the outbox after it is sent.

First, I added a constant that I found in the MAPI header file MAPIDefS.h.


Next I added two lines just before “outboxfolder.SaveChanges(0)”.


With these changes, the behavior in the outbox is consistent with 
sending messages directly from Outlook.

Steve Holden     
Python Web Programming
Holden Web LLC      +1 703 861 4237  +1 800 494 3119

More information about the Python-list mailing list