Dis*_*ner 2 python email django mailing html-email
我正在尝试使用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)
对于Name要显示的电子邮件的用户名部分,而不是,只是做
from_email = "info@domain.com <info@domain.com>"
Run Code Online (Sandbox Code Playgroud)
要么
from_email = "Name <info@domain.com>"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2396 次 |
| 最近记录: |