Django EmailMessage как отправить html сообщение
Добрый день, как я могу отправить html, когда я использую django EmailMessage
from django.shortcuts import render, HttpResponse
from django.core.mail import EmailMessage
def send_email(request):
msg = EmailMessage(
subject='this is the title',
body='this is the content',
from_email='test@gmail.com',
to=['anothertest@yahoo.com']
)
msg.attach_file('t2.xls')
msg.send(fail_silently=False)
return HttpResponse('OK')
Я пробовал html_message но все равно не работает:
msg = EmailMessage(
subject='this is the title',
body='this is the content',
from_email='test@gmail.com',
to=['anothertest@yahoo.com']
html_message = '<p>this is an automated message</p>'
)
Любой друг может помочь? Спасибо!