1. 发送html模板邮件
from django.core.mail import EmailMultiAlternatives
from django.core.mail import EmailMultiAlternatives
from django.template import Context, loader
subject, from_email, to = title, EMAIL_HOST_USER, mail_list
context={"name":huang,"passworld":123}
context={"name":huang,"passworld":123}
html_content = t.render(Context(context))
msg = EmailMultiAlternatives(subject, html_content, from_email, to)
msg.attach_alternative(html_content, "text/html")
msg.attach_file(u"/Python/doc/test.doc") # 添加附件发送