[python-win32] How to set content-type in Headers

Tim Roberts timr at probo.com
Tue Jan 8 00:08:57 CET 2008


Antony Joseph wrote:
>
> I am reading and  writing mails from outlook , I want to know how to 
> set the content-type for my Headers.
> For example,
> I want set  :
> content-transfer-encoding: 7bit
> content-type: text/plain; charset=iso-8859-1; format=flowed
>
> for subject
>
> content-transfer-encoding: 7bit
> content-type: text/html; charset=iso-8859-1; format=flowed
>
> for body..........
>
> Anyone tell me how could i do this?

I don't quite understand what you are asking.  A message part is either 
text/plain or text/html.  The subject is one of the headers, and headers 
do not have their own content-type.

Outlook will create the Content-Type headers automatically, based on the 
format of the body that you pass.  If you set the MailItem.BodyFormat to 
olFormatHTML, it will send the body as text/html.  If you set it to 
olFormatPlain, it will send the body as text/plain.  There's also an 
olFormatRichText that has fallen out of favor.

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



More information about the python-win32 mailing list