If you refer to libgmail
from sourceforge, you need to compose your messages with the email module.
Generate the HTML message as a MIME document, and include it as a part of a multipart MIME message. When you have a fully constructed multipart MIME, pass it along as a string to the libgmail
constructor, using to .as_string()
method.
An example in the doc contains the code for a similar requirement:
# Create message container - the correct MIME type is multipart/alternative.
msg = MIMEMultipart('alternative')
msg['Subject'] = "Link"
msg['From'] = me
msg['To'] = you
...
# Record the MIME types of both parts - text/plain and text/html.
# ... text and html are strings with appropriate content.
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)