Opened 3 weeks ago
Last modified 7 days ago
#36138 assigned New feature
Simplify ADMINS and MANAGERS email list settings — at Initial Version
Reported by: | Mike Edmunds | Owned by: | |
---|---|---|---|
Component: | Core (Mail) | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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, 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):
# 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>', ]