#36805: Use `None` as default value for `from_email` in `send_mail`-function
-------------------------------+--------------------------------------
Reporter: Adrian Bürger | Owner: (none)
Type: Uncategorized | Status: closed
Component: Core (Mail) | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Mike Edmunds):
Expanding on Jacob's response: `send_mail()` is one of the oldest
functions in Django and there's a lot of reluctance to change its
behavior. (You'll find comments in the code indicating its API is
"frozen.")
Django's `EmailMessage` class is a newer API that supports additional
features and more flexible usage. All of its parameters, including
`from_email`, are optional. So you can write:
{{{#!python
from django.core.mail import EmailMessage
EmailMessage(to=["[email protected]"], subject="quick note").send()
}}}
to send a message using the `DEFAULT_FROM_EMAIL` with an empty body.
--
Ticket URL: <https://code.djangoproject.com/ticket/36805#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019b47069c8d-a56b9ede-7ff6-43a7-8a0c-573875c7fcdc-000000%40eu-central-1.amazonses.com.