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')
- Django extract string from [ErrorDetail(string='Test Message', code='invalid')]
- Fabric – sudo -u
- Django Boolean Queryset Filter Not Working
- DateTimeField received a naive datetime
- How do I get a "debug" variable in my Django template context?
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
- Django: How to keep the test database when the test is finished?
- When should I use 'path' over 're_path'?
- Django Full Text SearchVectorField obsolete in PostgreSQL
- How to override template in django-allauth?
- Pivoting data and complex annotations in Django ORM
Source:stackexchange.com