#22161 closed Cleanup/optimization (fixed)
Document that sending an email with no recipients fails silently
Reported by: | Owned by: | Orlando Romero | |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | afraid-to-commit |
Cc: | eromijn@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If EmailMessage.recipients() is empty, EmailMessage.send() returns 0 instead of raising an exception, even if fail_silently is False.
Change History (12)
comment:1 by , 11 years ago
Has patch: | set |
---|
comment:2 by , 11 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:3 by , 11 years ago
Cc: | added |
---|
But that's technically not an error condition. send() does exactly what you asked it to do: send a mail to all recipients you specified. Why should this throw an exception?
Also, people may have become dependent on the behaviour that send() can be called even though recipients is empty. Therefore, if we do change this, I think it warrants at least a mention in the release notes, as a backwards incompatible change, although it will probably not hit too many users. I checked briefly, but it seems the current behaviour is not explicitly documented.
comment:4 by , 11 years ago
Needs documentation: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
comment:5 by , 11 years ago
I'm happy to add some documentation for this, but I'm not sure where is appropriate.
comment:6 by , 11 years ago
Erik has a point in his comment:3. We should first ponder arguments for or against raising an exception when sending email with no recipients.
comment:7 by , 10 years ago
Component: | Core (Mail) → Documentation |
---|---|
Has patch: | unset |
Needs documentation: | unset |
Summary: | Sending an email with no recipients fails silently → Document that sending an email with no recipients fails silently |
Type: | Bug → Cleanup/optimization |
I think we should document the behavior. The EmailMessage
class and receipients
argument is documented in docs/topics/email.txt
.
comment:8 by , 10 years ago
Keywords: | afraid-to-commit added |
---|
I've marked this ticket as especially suitable for people following the Don't be afraid to commit tutorial at the DjangoCon US 2014 sprints.
If you're tackling this ticket, please don't hesitate to ask me for guidance if you'd like any, either at the sprints themselves, or here or on the Django IRC channels, where I can be found as EvilDMP.
comment:9 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:10 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I've fixed this in https://github.com/Ian-Foote/django/tree/ticket_22161.