Opened 5 years ago
Closed 5 years ago
#30604 closed Cleanup/optimization (fixed)
Raise exceptions in mail_admins()/mail_managers() when settings are not in expected formats.
Reported by: | Kevin Blicharski | Owned by: | Hasan Ramezani |
---|---|---|---|
Component: | Core (Mail) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Hi,
First time writing a ticket so I apologize if I do anything improperly here. This issue just arose on a project I've been working on, and it goes as follows:
Our MANAGERS setting was set like so:
MANAGERS = ['one@example.com', 'two@example.com']
And after calling mail_managers, the result was:
smtplib.SMTPRecipientsRefused: {'=?utf-8?q?h?=': (550, b'5.1.1 <=?utf-8?q?h?=>: Recipient address rejected: User unknown in local recipient table'), '=?utf-8?q?u?=': (550, b'5.1.1 <=?utf-8?q?u?=>: Recipient address rejected: User unknown in local recipient table')}
After some investigation it became clear that this setting was in the improper format, but that was only because of this StackOverflow post. It would be nice if Django failed early if this setting was detected but improperly set, rather than waiting until the consequences become apparent.
Thank you,
Kevin
Change History (4)
comment:1 by , 5 years ago
Component: | Error reporting → Core (Mail) |
---|---|
Easy pickings: | set |
Owner: | set to |
Summary: | mail_managers fails with unhelpful error when MANAGERS is set incorrectly → Raise exceptions in mail_admins()/mail_managers() when settings are not in expected formats. |
Triage Stage: | Unreviewed → Accepted |
Type: | New feature → Cleanup/optimization |
Version: | 2.2 → master |
comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Thanks for the report. It seems reasonable to raise
ValueError
inmail_admins()
andmail_managers()
when settings are not in expected formats.