Python and Outlook, sendinf an image in the body of email

Ian Kelly ian.g.kelly at gmail.com
Mon Jul 23 16:32:36 EDT 2012


On Mon, Jul 23, 2012 at 12:33 PM,  <bruceg113355 at gmail.com> wrote:
> I tried something similar to the example at http://stackoverflow.com/questions/4312687/how-to-embed-images-in-email .
>
> Problem is, this line is not understood:
>        mail.BodyFormat = OlBodyFormat.olFormatHTML
>
>     Traceback (most recent call last):
>       ...
>       appt.BodyFormat = OlBodyFormat.olFormatHTML
>     NameError: name 'OlBodyFormat' is not defined

Assuming you've run makepy to generate the static dispatch Python module for the
Outlook type library, all generated constants are available via
win32com.client.constants  Try:

appt.BodyFormat = win32com.client.constants.olFormatHTML



More information about the Python-list mailing list