#17811: Connection object is no passed to the EmailMessage constructor when 
called
from send_mass_mail
-------------------------------------+-------------------------------------
     Reporter:  Fedor Tyurin         |                    Owner:  Daniel
                                     |  Roseman
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Mail)          |                  Version:  1.3
     Severity:  Normal               |               Resolution:  fixed
     Keywords:  mail, connection,    |             Triage Stage:  Ready for
  email                              |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Mike Edmunds):

 Replying to [ticket:17811 Fedor Tyurin]:
 > This causes troubles if email backend stores something inside the self
 object for the later use and expects that messages would have reference to
 it.

 In general, an EmailBackend instance ''cannot'' assume that
 `EmailMessage.connection` has been set to the backend instance after the
 backend has been used to send the message. Django supports (and
 [https://docs.djangoproject.com/en/6.0/topics/email/#topics-sending-
 multiple-emails documents]) directly calling `backend.send_messages([...
 list of EmailMessage ...])`, which doesn't set the `connection` property
 on the sent messages. See #35864.

 If a specific backend implementation needs to ensure
 `EmailMessage.connection` is always set, it should set each message's
 `connection` property to `self` in its `send_messages()` method.

 (Also, we're about to deprecate and remove `connection` entirely as part
 of #35514.)
-- 
Ticket URL: <https://code.djangoproject.com/ticket/17811#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019dc11f811a-fc92bc05-4f77-4f84-bf06-f90e7a3ee068-000000%40eu-central-1.amazonses.com.

Reply via email to