[Fixed]-How to specify name in Django mail?

28👍

You can use

"(MyCompany) Support <no-reply@mycompany.com>"

as the from address in the call to send_mail.

17👍

Those solutions are useful if you’re using django’s email package directly. However, i didn’t want to look for a hook to override the way that django-registration uses send_mail so I found the following setting when going through the django files, which lets you set a default from email.

 DEFAULT_FROM_EMAIL='(My Company) Support <no-reply@mycompany.com>' 

and it worked!

Figured someone else may find it useful, although i’m not so pretentious as to mark my own answer as correct.

2👍

You can use ADMINS and MANAGERS tuples in setting.py. E.g.:

ADMINS = (('Your Name', 'email@company.com),)

And then:

django.core.email.mail_managers('subject', 'body')

2👍

DEFAULT_FROM_EMAIL='(My Company) Support ‘

Helped me to solve the issue.

0👍

Another explicit way is to use the Address

read my other answer here

from email.headerregistry import Address

DEFAULT_FROM_EMAIL = Address(display_name="Company Name", addr_spec="info@domain.com")
👤Art

Leave a comment