【发布时间】:2013-06-08 12:09:03
【问题描述】:
views.py
if 'send_email' in request.POST:
subject, from_email, to = 'Parent Incident Notification',user.email, person.parent_email
html_content = render_to_string('incident/print.html',{'person':person,
'report':report,
})
text_content = strip_tags(html_content)
msg = EmailMultiAlternatives(subject, text_content, settings.DEFAULT_FROM_EMAIL, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()
以上是发送电子邮件的视图。通过这种方式,我可以将html内容与邮件一起发送,它将电子邮件单独发送到[to]地址,我也想再做一个密件抄送和抄送。我经历了文档中的Emailmessage objects。我不知道如何包含密件抄送和抄送来改变我的观点。
需要帮助。
谢谢
【问题讨论】:
标签: django django-models django-forms django-views