Send HTML e-mail in Python?

Mike Meyer mwm at mired.org
Tue Nov 2 16:53:29 EST 2004


mksql at yahoo.com (Max) writes:

> 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 need to add MIME headers to the mail message. I.e., along with the
From: and Subject: lines, add:

MIME-Version: 1.0
Content-Type: text/html

As long as you're using straight ascii, that should be sufficient. If
you want to use extended character sets, things get messy. See <URL:
http://www.cse.ohio-state.edu/cs/Services/rfc/smtplist.html > for the
RFCs you'll want to look at.

     <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list