Opened 14 months ago

Closed 8 months ago

Last modified 8 months ago

#22161 closed Cleanup/optimization (fixed)

Document that sending an email with no recipients fails silently

Reported by: ian@… Owned by: oromero
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 Changed 14 months ago by ian@…

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 14 months ago by claudep

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:3 Changed 14 months ago by erikr

  • Cc eromijn@… 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 Changed 14 months ago by claudep

  • Needs documentation set
  • Triage Stage changed from Ready for checkin to Accepted

comment:5 Changed 14 months ago by ian@…

I'm happy to add some documentation for this, but I'm not sure where is appropriate.

comment:6 Changed 14 months ago by claudep

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 Changed 8 months ago by timgraham

  • Component changed from Core (Mail) to Documentation
  • Has patch unset
  • Needs documentation unset
  • Summary changed from Sending an email with no recipients fails silently to Document that sending an email with no recipients fails silently
  • Type changed from Bug to Cleanup/optimization

I think we should document the behavior. The EmailMessage class and receipients argument is documented in docs/topics/email.txt.

comment:8 Changed 8 months ago by EvilDMP

  • 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 Changed 8 months ago by oromero

  • Owner changed from nobody to oromero
  • Status changed from new to assigned

comment:10 Changed 8 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 0f0a5c07f9f0f4d18d4c048ed6d9554965f79d5b:

Fixed #22161 -- Documented send() with no recipients won't raise an exception.

comment:11 Changed 8 months ago by Tim Graham <timograham@…>

In 414e3fc59dcb429d9d96a91348f7c0eb661d70fa:

[1.6.x] Fixed #22161 -- Documented send() with no recipients won't raise an exception.

Backport of 0f0a5c07f9 from master

comment:12 Changed 8 months ago by Tim Graham <timograham@…>

In af28f3c17515a1de9abb668942e896d777b67cba:

[1.7.x] Fixed #22161 -- Documented send() with no recipients won't raise an exception.

Backport of 0f0a5c07f9 from master

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