#36138: Simplify ADMINS and MANAGERS email list settings
------------------------------+---------------------------------------
     Reporter:  Mike Edmunds  |                     Type:  New feature
       Status:  new           |                Component:  Core (Mail)
      Version:  5.1           |                 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
------------------------------+---------------------------------------
 Django should allow the
 [https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-ADMINS
 ADMINS] and [https://docs.djangoproject.com/en/5.1/ref/settings/#managers
 MANAGERS] settings to be simple lists of email addresses, like this:

 {{{#!python
 # Doesn't work in Django through 5.2:
 ADMINS = ["[email protected]", "[email protected]"]
 }}}

 Right now, those settings both expect a list of tuples of (full name,
 email address). But the name part ''is ignored'' in both
 [https://github.com/django/django/blob/main/django/core/mail/__init__.py#L134
 mail_admins()] and
 
[https://github.com/django/django/blob/330d89d4fe7832355535580383523f1749a3ee45/django/core/mail/__init__.py#L154
 mail_managers()]—and it's
 
[https://github.com/django/django/blob/ed114e15106192b22ebb78ef5bf5bce72b419d13/django/core/mail.py#L43-L51
 been ignored] for at least 20 years (as far back as the Git history goes):

 {{{#!python
 ADMINS = [("name is ignored", "[email protected]"), ("ignored",
 "[email protected])]
 }}}

 #30604 added an error on detecting the (reasonable) mistake of trying to
 set ADMINS or MANAGERS to a simple list of addresses as in first example.

 This ticket proposes instead allowing—and documenting—simple address lists
 in these settings. For compatibility, Django would also continue to
 support the list-of-tuples form (with the name field ignored).

 Incidentally, if you ''do'' want to include a display-name in the
 admins/managers recipients lists, that can be done with the RFC 5322
 `"name" <addr>` format (which is accepted by all the django.core.mail
 APIs):

 {{{#!python
 # Works in Django 5.2 and earlier:
 ADMINS = [
     ("ignored", "John <[email protected]>"),
     ("ignored", '"Mary, IT (Ops)" <[email protected]>'),
 ]

 # Also allowed after this proposed change:
 ADMINS = [
     "John <[email protected]>",
     '"Mary, IT (Ops)" <[email protected]>',
 ]
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36138>
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/010701949f3ca478-59c7bb91-c7cf-4ae1-873b-17523633bcb9-000000%40eu-central-1.amazonses.com.

Reply via email to