[python-win32] get embedded images from outlook

Tim Roberts timr at probo.com
Tue Jan 8 00:01:11 CET 2008


Antony Joseph wrote:
>
> This code can  read the content of mails body , html and headers from 
> outlook.
> in case , it there's an embedded image,
> Its not getting the image,
> ...
> prop_ids = (PR_BODY_A,MYPR_BODY_HTML_A,PR_TRANSPORT_MESSAGE_HEADERS_A)
> hr,data=obj.GetProps(prop_ids,0)
> body = GetPotentiallyLargeStringProp(obj,prop_ids[0],data[0])
> html = GetPotentiallyLargeStringProp(obj,prop_ids[1],data[1])
> headers =GetPotentiallyLargeStringProp(obj,prop_ids[2],data[2])
>
> can anybody tell me ,
>
> how can i get the images?

PR_HASATTACH tells you whether the message has an attachment.  Then, 
you'll have to fetch the attachment table for the message, and fetch the 
data from that.  You may need to do some reading about this.  You can 
fetch the PR_MESSAGE_ATTACHMENTS property to get the table, it is of 
type IMAPITable, not IStream.  You then have to enumerate those, and 
fetch the PR_ATTACH_DATA_BIN property for the attachment you want.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list