[Django] #32633: send_mail must make `from_email` argument optional

15 views
Skip to first unread message

Django

unread,
Apr 11, 2021, 12:37:54 AM4/11/21
to django-...@googlegroups.com
#32633: send_mail must make `from_email` argument optional
------------------------------------------------+------------------------
Reporter: aryan340 | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Mail) | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/32633>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 11, 2021, 12:42:17 AM4/11/21
to django-...@googlegroups.com
#32633: send_mail must make `from_email` argument optional
-------------------------------------+-------------------------------------
Reporter: aryan340 | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Core (Mail) | Version: 3.2
Severity: Normal | Resolution:

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 aryan340):

https://github.com/django/django/pull/14249
I made a pull request.

--
Ticket URL: <https://code.djangoproject.com/ticket/32633#comment:1>

Django

unread,
Apr 11, 2021, 12:43:25 AM4/11/21
to django-...@googlegroups.com
#32633: send_mail must make `from_email` argument optional
-------------------------------------+-------------------------------------
Reporter: aryan340 | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Core (Mail) | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aryan340):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/32633#comment:2>

Django

unread,
Apr 11, 2021, 4:41:36 AM4/11/21
to django-...@googlegroups.com
#32633: send_mail must make `from_email` argument optional
-------------------------------------+-------------------------------------
Reporter: Aryan Iyappan | Owner: nobody
Type: | Status: closed
Cleanup/optimization |

Component: Core (Mail) | Version: 3.2
Severity: Normal | Resolution:
| worksforme
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

* status: new => closed
* resolution: => worksforme


Comment:

`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.

--
Ticket URL: <https://code.djangoproject.com/ticket/32633#comment:3>

Reply all
Reply to author
Forward
0 new messages