I am using smtplib to create a MIMEMultipart email and the result is a header that looks as follows.
MIME-Version: 1.0
Content-Type: multipart/alternative; charset="utf-8"; boundary="===============2613033831060434871=="
Content-Transfer-Encoding: base64
Subject: Your report is ready
From: no-reply@example.com
To: someone@example.com
Is this a valid e-mail header? Have experienced no complaints except for one person who is experiencing their e-mail being cut off before showing the body of the e-mail. They claim that it's because the Content-Type is appearing in the wrong place.
This is how the message was created
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from cl.library.htmlutils import html_to_text
def make_multipart_email(from_addr, to_addr, html, subject=None, text=None):
text = text or html_to_text(html)
msg = MIMEMultipart('alternative')
msg.set_charset('utf8')
msg['Subject'] = subject
msg['From'] = from_addr
msg['To'] = to_addr
msg.attach(MIMEText(text, 'plain', 'UTF-8'))
msg.attach(MIMEText(html, 'html', 'UTF-8'))
return msg