Python 使用EmailMultiAlternations向django发送电子邮件

Python 使用EmailMultiAlternations向django发送电子邮件,python,django,email,html-email,mailing,Python,Django,Email,Html Email,Mailing,我正在尝试使用Django和EmailMultiAlternations发送邮件。它运行良好,但在“from”中表示“info” 比如说,能说出我的名字吗?我该怎么做 这是我的密码: subject, from_email, to = 'Afiliations', 'info@domain.com', 'other@domain.com' text_content = 'Afiliation is working.' t = loader.get_template('emails/afiliad

我正在尝试使用Django和EmailMultiAlternations发送邮件。它运行良好,但在“from”中表示“info”

比如说,能说出我的名字吗?我该怎么做

这是我的密码:

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()

要显示电子邮件中的
名称
,而不是用户名部分,只需执行以下操作

from_email = "info@domain.com <info@domain.com>"
from_email=”info@domain.com "

from_email=“Name”

您想在电子邮件收件箱中显示自定义名称吗?为什么不从您的域中更改名称?我认为这是电子邮件的用户名部分。试试这个:
“info@domain.com“
如果我为此更改域:myname@domain.com那么“from”将是“myname”,但不大写。我不认为这是正确的方法。谢谢@karthikr,这是有效的:“Name”。如果你想回答,我可以标为正确。
from_email = "Name <info@domain.com>"