Opened 3 weeks ago
Last modified 6 days ago
#36138 assigned New feature
Simplify ADMINS and MANAGERS email list settings
Reported by: | Mike Edmunds | Owned by: | Mike Edmunds |
---|---|---|---|
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 (last modified by )
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>', ]
Change History (8)
comment:1 by , 2 weeks ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 2 weeks ago
comment:3 by , 12 days ago
Description: | modified (diff) |
---|---|
Resolution: | wontfix |
Status: | closed → new |
Reopened, deprecating the tuples, based on forum feedback.
comment:4 by , 10 days ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:6 by , 7 days ago
Has patch: | set |
---|
comment:7 by , 7 days ago
Patch needs improvement: | set |
---|
comment:8 by , 6 days ago
Patch needs improvement: | unset |
---|
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.