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 Mariusz Felisiak, 5 years ago

Component: Error reportingCore (Mail)
Easy pickings: set
Owner: set to nobody
Summary: mail_managers fails with unhelpful error when MANAGERS is set incorrectlyRaise exceptions in mail_admins()/mail_managers() when settings are not in expected formats.
Triage Stage: UnreviewedAccepted
Type: New featureCleanup/optimization
Version: 2.2master

Thanks for the report. It seems reasonable to raise ValueError in mail_admins() and mail_managers() when settings are not in expected formats.

comment:2 by Hasan Ramezani, 5 years ago

Owner: changed from nobody to Hasan Ramezani
Status: newassigned

comment:3 by Hasan Ramezani, 5 years ago

Has patch: set
Version 0, edited 5 years ago by Hasan Ramezani (next)

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 090ca65:

Fixed #30604 -- Made mail_admins()/mail_managers() raise ValueError if ADMINS/MANAGERS is set incorrectly.

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