[python-win32] mapi.ATTACH_EMBEDDED_MSG

Mark Hammond skippy.hammond at gmail.com
Thu Jan 7 05:52:05 CET 2010


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