[python-win32] Set html in outlook mail
Tim Roberts
timr at probo.com
Wed Mar 23 17:26:43 CET 2011
Luca wrote:
>
> Hi everybody, I’m trying to send an email via outlook and everything
> works fine with the following code:
>
>
>
> obj = win32com.client.Dispatch(/"Outlook.Application"/)
>
> formail inLmail:
>
> newMail = obj.CreateItem(0)
>
> newMail.To = mail
>
> newMail.Subject = /"_Title_"/
>
> newMail.Body = /"_CIAO_"/
>
> newMail.Send()
>
>
>
> Now I have to send an htm mail instead than normal plain text but I
> can’t find anything to do that.
>
Add:
import win32con
newMail.BodyFormat = win32con.olFormatHTML
newMail.HTMLBody = "<html><body>CIAO!</body></html>"
All I did was go to the MSDN page on the CreateItem method of the
Outlook.Application object.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list