[Zope, Python 01/02/2009]
Mail html
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
def htmlMailer(self, mfrom, mto, subject, html, text):
# Create message container - the correct MIME type is multipart/alternative.
msg = MIMEMultipart('alternative')
msg['Subject'] = subject
msg['From'] = mfrom
msg['To'] = mto
# Create the body of the message (a plain-text and an HTML version).
text = text
# Record the MIME types of both parts - text/plain and text/html.
part1 = MIMEText(text, 'plain')
part2 = MIMEText(html, 'html')
# Attach parts into message container.
# According to RFC 2046, the last part of a multipart message, in this case
# the HTML message, is best and preferred.
msg.attach(part1)
msg.attach(part2)
self.MailHost.send(msg.as_string())