【发布时间】:2017-06-16 19:50:39
【问题描述】:
from django.core.mail import EmailMultiAlternatives
subject, from_email, to = 'hello', 'from@example.com', 'to@example.com'
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()
我希望能够发送设计正确的简报或电子邮件,如果可能的话,包括图片。我想知道我是否可以改变这个
html_content = '<p>This is an <strong>important</strong> message.</p>'
到一个 html 模板文件中。像这样
html_content = 'newsletter/news.html'
如果不是,那么我该如何发送类似 Quora 和其他网站的电子邮件。`
【问题讨论】: