[python-win32] mapi.ATTACH_EMBEDDED_MSG

Laurent Duchesne l at urent.org
Mon Jan 11 13:50:00 CET 2010


Thanks, it's working now :)

In case someone wants to know, I will be converting my .eml source file to
a message object using this call:
IConverterSession::MIMEToMAPI  (outlook 2003+)
http://msdn.microsoft.com/en-us/library/aa193062(office.11).aspx

Since not all calls are available using python, I will use a C++ wrapper
which looks something like this:
std::wstring ConvertMIMEToMAPI(const std::wstring& p_rSourceFilename);
Where the return value is a filename containing a compoung object
(CLSID_MailMessage) which I hope I will be able to read back in python.

Laurent

On Thu, 07 Jan 2010 15:52:05 +1100, Mark Hammond
<skippy.hammond at gmail.com>
wrote:
> On 7/01/2010 6:15 AM, lduchesne wrote:
>>
>> Hi,
>>
>> I'm tying to embed a mail message in another mail using the following
>> code:
>>
>> [...]
>> imsg = draftFolder.CreateMessage(None, 0)
>> message = outboxFolder.CreateMessage(None, 0)
>> attach = message.CreateAttach(None, 0)
>>
>> attach[1].SetProps([(mapitags.PR_ATTACH_METHOD,
>> mapi.ATTACH_EMBEDDED_MSG),
>>                      (mapitags.PR_ATTACH_DATA_OBJ, imsg),
>>                      (mapitags.PR_DISPLAY_NAME, filename),
>>                      (mapitags.PR_ATTACH_LONG_FILENAME, filename)])
> 
> You will need something like:
> 
> attachMsg = imsg.OpenProperty(mapitags.PR_ATTACH_DATA_OBJ, 
> mapi.IID_IMessage, 0, mapi.MAPI_CREATE)
> 
> After which you have an IMessage for the new item.  You can then 
> probably use the CopyTo() method to copy from the source to the new one.
> 
> HTH,
> 
> Mark


More information about the python-win32 mailing list