How do I send an email in Django with a certain mimetype?

django, email, mime, python, smtp

Solution

From the docs:

msg = EmailMessage(subject, html_content, from_email, [to])
msg.content_subtype = "html"  # Main content is now text/html
msg.send()

You can only change the subtype of the mimetype it seems. So it will always be

`"text/%s" % msg.content_subtype`

Problem

``` MYMESSAGE = "<div>Hello</div><p></p>Hello" send_mail("testing",MYMESSAGE,"noreply@mydomain.com",['assdf@gmail.com'],fail_silently=False) ``` However, this message doesn't get the HTML mime type when it is sent. In my outlook, I see the code...

Original source