howto send html mails using smtplib

Philippe C. Martin philippe at philippecmartin.com
Fri Jun 10 09:26:23 EDT 2005


Tim,

You are most correct, replace_header did the trick.

Thanks a bunch.


Philippe



Tim Williams wrote:

> "Philippe C. Martin" <philippe at philippecmartin.com> wrote in message
> news:sD3qe.2270$751.1207 at newssvr30.news.prodigy.com...
>>  I have the following problem:
>> 1) I can use smtplib to send text messages
>> 2) I can generate html
>> 3) I want to email the html and want it to be seen by the email client as
>> html.
>>
>> However, when I receive the message, the email client displays it as text
>> (code hereunder) - I assume it has to do with the MIMEText call but since
> I
>> cannot see any MIMEhtml .....
> 
> 
> I suspect you need one of the following lines.
> 
> msg.replace_header('Content-Type', 'text/html')
> 
> msg.add_header('Content-Type', 'text/html')
> 
> 
> HTH :)
> 




More information about the Python-list mailing list