[Answer]-Django EmailMessage with attachment issue

1👍

You need use EmailMultiAlternatives

from django.core.mail import EmailMultiAlternatives

msg = EmailMultiAlternatives(subject, content, from_email, to_list, cc=cc_list, bcc=bcc_list)
if attach_file_name:
    msg.attach_file(attach_file_name, mimetype="text/html")
msg.send()

0👍

I read the file with help of BeautifulSoup and then I attach that file to email then html is coming in proper format

👤Mugdha

Leave a comment