#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: master
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 Changed 13 months ago by felixxm

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 Changed 12 months ago by Hasan Ramezani

Owner: changed from nobody to Hasan Ramezani
Status: newassigned

comment:3 Changed 12 months ago by Hasan Ramezani

Has patch: set
Last edited 12 months ago by felixxm (previous) (diff)

comment:4 Changed 12 months ago by Mariusz Felisiak <felisiak.mariusz@…>

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