Django EmailMessage with attachment issue -


i using emailmessage send mail attachment. attachment .html file. successful in attaching file in email. html not display properly. html file showing tag in attachment content.

code return follows,

attach_file_name file path want display i.e. "/path/of/html/file.html"

msg = emailmessage(subject, content, from_email, to_list, cc=cc_list, bcc=bcc_list) if attach_file_name:     msg.attach_file(attach_file_name) msg.content_subtype = "html" msg.send() 

please me

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() 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -