3

I'm trying to send a mail using Django with EmailMultiAlternatives. It works well but in "from" says "info"

Is it posible to say my name for example? How can I do this?

Here is my code:

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()
Disoner
  • 33
  • 1
  • 3

1 Answers1

8

For the Name to be displayed instead of the username part of the email, just do

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

OR

from_email = "Name <info@domain.com>"
karthikr
  • 97,368
  • 26
  • 197
  • 188