Если вы ссылаетесь на libgmail
из sourceforge, вам нужно составить свои сообщения с помощью модуля электронной почты .
Создайте HTML-сообщение как MIME-документ и включите его как часть составного MIME-сообщения . Если у вас есть полностью сконструированный составной MIME, передайте его в виде строки конструктору libgmail
, используя метод .as_string()
.
Пример в документе содержит код для аналогичного требования:
# 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)