#36805: Use `None` as default value for `from_email` in `send_mail`-function
-------------------------------+-----------------------------------------
     Reporter:  Adrian Bürger  |                     Type:  Uncategorized
       Status:  new            |                Component:  Core (Mail)
      Version:  4.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 docstring of the function `send_mail` states that

 "If from_email is None, use the DEFAULT_FROM_EMAIL setting."

 `from_email` is a required argument which would explicitly need to be set
 to `None` so that `DEFAULT_FROM_EMAIL` is applied. However, other inputs
 of this function such as `auth_user` and `auth_password` which have a
 settings-value applied if they are `None`, are given a default value of
 `None`. Therefore, I am not a sure whether this behavior is intended;
 personally, I would expect `from_email` to have a default value of `None`.
 Otherwise, users get an unexpected `TypeError: send_mail() missing 1
 required positional argument: 'from_email'`.

 I see this in Django 4.2 but still also in the current main branch on
 GitHub.

 Thank you for your consideration and for your work.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36805>
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/0107019b27ac6706-2252d27b-5177-48cd-af7b-afb1096150f6-000000%40eu-central-1.amazonses.com.

Reply via email to