小编Dis*_*ner的帖子

使用EmailMultiAlternatives向django发送电子邮件

我正在尝试使用Django和EmailMultiAlternatives发送邮件.它运作良好,但在"来自"说"信息"

举个例子说我的名字是否可行?我怎样才能做到这一点?

这是我的代码:

subject, from_email, to = 'Afiliations', 'info@domain.com', 'other@domain.com'
text_content = 'Afiliation is working.'
t = loader.get_template('emails/afiliados.html')
c = Context({ 'order': order_obj })
html_content = t.render(c)
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()
Run Code Online (Sandbox Code Playgroud)

python email django mailing html-email

2
推荐指数
1
解决办法
2396
查看次数

标签 统计

django ×1

email ×1

html-email ×1

mailing ×1

python ×1