Send HTML e-mail in Python?

Steve Holden steve at holdenweb.com
Wed Nov 3 02:44:34 CET 2004


Max wrote:

> I am looking for some simple example code on generating SMTP e-mail
> messages in Python. I have a script that sends system reports to me at
> a central e-mail address, and it works fine using smtplib with plain
> text messages. I would like to enhance this script to send HTML
> formatted messages instead.
> 
> Simply sending a text message with HTML tags does not work. The e-mail
> client displays the message as plain text with visible <tags>.

You probably didn't include a "Content-Type: text/html" header in the 
RFC822 headers. If that wasn't the problem I do have some code that 
works, but I'd have to strip out client-specific features before I 
posted it.

regards
  Steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119



More information about the Python-list mailing list