Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#32471 closed Cleanup/optimization (fixed)

Document the return value of EmailMessage.send()

Reported by: Baptiste Mispelon Owned by: Hasan Ramezani
Component: Documentation 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

The documentation for EmailMessage.send() [1] currently reads:

send(fail_silently=False) sends the message. If a connection was specified when the email was constructed, that connection will be used. Otherwise, an instance of the default backend will be instantiated and used. If the keyword argument fail_silently is True, exceptions raised while sending the message will be quashed. An empty list of recipients will not raise an exception.

As a reference doc, it would be more useful if it also mentioned the return value of that method.

There are two documented hints as to what the return value might be:

  • The documentation for send_mail() [2]:

    The return value will be the number of successfully delivered messages (which can be 0 or 1 since it can only send one message).

  • The documentation for writing custom backends [3]:

    A custom email backend must implement the send_messages(email_messages) method [which] returns the number of successfully delivered messages.

[1] https://docs.djangoproject.com/en/dev/topics/email/#emailmessage-objects
[2] https://docs.djangoproject.com/en/dev/topics/email/#send-mail
[3] https://docs.djangoproject.com/en/dev/topics/email/#defining-a-custom-email-backend

Change History (5)

comment:1 by Mariusz Felisiak, 4 years ago

Needs documentation: unset
Triage Stage: UnreviewedAccepted

comment:2 by Hasan Ramezani, 4 years ago

Has patch: set
Owner: changed from nobody to Hasan Ramezani
Status: newassigned

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

Resolution: fixed
Status: assignedclosed

In b1af2cca:

Fixed #32471 -- Doc'd the return value of EmailMessage.send().

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

In 5431718:

[3.2.x] Fixed #32471 -- Doc'd the return value of EmailMessage.send().

Backport of b1af2cca3aba4cefc69c986d4de6cab6db524bf3 from master

comment:5 by Baptiste Mispelon, 4 years ago

That was fast, thanks everyone!✨

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