from django.core.mail import EmailMultiAlternatives
subject, from_email, to = 'hello', '[email protected]', '[email protected]'
text_content = 'This is an important message.'
html_content = '<p>This is an <strong>important</strong> message.</p>'
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()
发送正规的邮件我希望能够把已经设计得当,包括如果可能的图像通讯或电子邮件。我想知道是否可以将这个通过Django的
html_content = '<p>This is an <strong>important</strong> message.</p>'
转换成html模板文件。像这样
html_content = 'newsletter/news.html'
如果没有,那么我怎么去发送电子邮件一样,Quora的和其他websites.`
可能使用[用Django创建电子邮件模板]的副本(http://stackoverflow.com/questions/2809547/creating-email-templates-with-django) – Sayse