Simple Sending Email HTML in Django, Django have a module for email, one of them is EmailMessage, and in the class of EmailMessage have a function content_subtype, so, u can change it with what your type do u want, like plain text, or html. Default from django is plain text. Let’s checkout it:

>>> from django.core.mail import EmailMessage
>>> dir(EmailMessage.content_subtype)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__' ,...., 'swapcase', 'title', 'translate', 'upper', 'zfill']
>>> msg = EmailMessage.content_subtype
>>> msg
>>> msg = EmailMessage.content_subtype = "html"
>>> msg

Awesome right? laugh 
Now, how i can use it?

from django.core.mail import EmailMessage
subject = "This is subject"
message = "This is body message"

def send_email(to_list, subject, message, sender="Aircourts "):
    msg = EmailMessage(subject, message, sender, to_list)
    msg.content_subtype = "html"  # Main content is now text/html
    return msg.send() #replace 'return' if you use like a form or something else.


146 7 7 0