#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 = ["
jo...@example.com", "
ma...@example.com"]
}}}
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", "
jo...@example.com"), ("ignored",
"
ma...@example.com)]
}}}
#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 <
jo...@example.com>"),
("ignored", '"Mary, IT (Ops)" <
ma...@example.com>'),
]
# Also allowed after this proposed change:
ADMINS = [
"John <
jo...@example.com>",
'"Mary, IT (Ops)" <
ma...@example.com>',
]
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/36138>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.