Django should allow the ADMINS and MANAGERS settings to be simple lists of email addresses, like this:
# Doesn't work in Django through 5.2:
ADMINS = ["john@example.com", "mary@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 mail_admins() and mail_managers()—and it's been ignored for at least 20 years (as far back as the Git history goes):
ADMINS = [("name is ignored", "john@example.com"), ("ignored", "mary@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 during a standard deprecation period, Django would also continue to support the list-of-tuples form (with the name field ignored). After deprecation, tuples would raise an error. [Edits: deprecated tuples, based on forum discussion.]
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):
# Works in Django 5.2 and earlier:
ADMINS = [
("ignored", "John <john@example.com>"),
("ignored", '"Mary, IT (Ops)" <mary@example.com>'),
]
# Also allowed after this proposed change:
ADMINS = [
"John <john@example.com>",
'"Mary, IT (Ops)" <mary@example.com>',
]
Thank you for the ticket!
I think this is a good suggestion, however can you raise this on the Django forum first as I want to check the community appetite on:
I'll close the ticket for now, but if we have agreement whether to deprecate or not, please return to this ticket and reference the forum discussion so we can re-open it. For more information, please refer to the documented guidelines for requesting features.