Opened 5 years ago
Closed 5 years ago
#32633 closed Cleanup/optimization (worksforme)
send_mail must make `from_email` argument optional
| Reported by: | Aryan Iyappan | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Mail) | Version: | 3.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
the django docs state that, while sending mail, if no from_email is passed, it will use the DEFAULT_FROM_EMAIL.
source: https://docs.djangoproject.com/en/3.1/topics/email/
from_email: A string. If None, Django will use the value of the DEFAULT_FROM_EMAIL setting.
However, when using the send_mail function, the from_email argument is not optional.
A workaround for this right now is this.
send_mail(
subject=subject,
message=message,
recipient_list=[self.user.email],
from_email=None
)
giving a default value of None to it will resolve this issue.
Change History (3)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
| Has patch: | set |
|---|
comment:3 by , 5 years ago
| Resolution: | → worksforme |
|---|---|
| Status: | new → closed |
DEFAULT_FROM_EMAIL will be used if you explicitly pass None to the from_email argument.
We cannot change the order of arguments as it would be backward-incompatible.
https://github.com/django/django/pull/14249
I made a pull request.