Opened 5 weeks ago

Last modified 3 weeks 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
Pull Requests:19143 build:success

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>',
]

According to the ticket's flags, the next step(s) to move this issue forward are:

  • For anyone except the patch author to review the patch using the patch review checklist and either mark the ticket as "Ready for checkin" if everything looks good, or leave comments for improvement and mark the ticket as "Patch needs improvement".

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top