Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions simplegmail/gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,18 +884,16 @@ def _create_message(

msg_html += "<br /><br />" + account_sig

attach_plain = MIMEMultipart('alternative') if attachments else msg
attach_html = MIMEMultipart('related') if attachments else msg
text_part = MIMEMultipart('alternative') if attachments else msg

if msg_plain:
attach_plain.attach(MIMEText(msg_plain, 'plain'))
text_part.attach(MIMEText(msg_plain, 'plain'))

if msg_html:
attach_html.attach(MIMEText(msg_html, 'html'))
text_part.attach(MIMEText(msg_html, 'html'))

if attachments:
attach_plain.attach(attach_html)
msg.attach(attach_plain)
msg.attach(text_part)

self._ready_message_with_attachments(msg, attachments)

Expand Down