On Wed, Dec 10, 2008 at 10:18 AM, James <[EMAIL PROTECTED]> wrote: > All, > > I'm trying to figure out a way to send html email using Python. I've > found scripts such as the one in the link below: > > http://www.stevecoursen.com/2008/10/sending-html-email-from-python.html/ > > These don't seem to work well. I took a (very) basic html page and had > the script in the page above read that page and then set up the text / > html email. When my client received the message it was filled with > visible html tags. > > The ultimate goal is to have a script that displays a simple HTML > table that's easily readable by anyone using a client capable of > interpreting html emails.
It might help to see your code, if it is different at all from what is on that page. What was printed? Here is a redacted version of a function that worked for me. This sends HTML only - no text part: from email.mime.text import MIMEText from email.Utils import formatdate def emailReport(): report = ... # Get HTML text from somewhere msg = MIMEText(report, 'html', 'utf-8') msg['Subject'] = 'report' msg['From'] = '[EMAIL PROTECTED]' msg['To'] = '[EMAIL PROTECTED]' msg['Date'] = formatdate() server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT) server.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', msg.as_string()) try: server.quit() except: return Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor