[Django] #34477: Asyncio send mail backend

10 views
Skip to first unread message

Django

unread,
Apr 9, 2023, 12:46:51 AM4/9/23
to django-...@googlegroups.com
#34477: Asyncio send mail backend
--------------------------------------------+------------------------
Reporter: Andrew Chen Wang | Owner: nobody
Type: New feature | Status: new
Component: Core (Mail) | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
--------------------------------------------+------------------------
Implementation of asyncio send mail functionality. All methods get its `a`
prefix variant, and the get_connection runs a start command unlike its
sync version.

--
Ticket URL: <https://code.djangoproject.com/ticket/34477>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 9, 2023, 12:51:05 AM4/9/23
to django-...@googlegroups.com
#34477: Asyncio send mail backend
----------------------------------+--------------------------------------

Reporter: Andrew Chen Wang | Owner: nobody
Type: New feature | Status: new
Component: Core (Mail) | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Andrew Chen Wang):

* needs_docs: 0 => 1
* needs_tests: 0 => 1


Old description:

> Implementation of asyncio send mail functionality. All methods get its
> `a` prefix variant, and the get_connection runs a start command unlike
> its sync version.

New description:

Implementation of asyncio send mail functionality. All methods get its `a`
prefix variant, and the get_connection runs a start command unlike its
sync version.

https://github.com/django/django/pull/16744

Adds Base, Console, and Dummy backends (no test; pending review of draft
implementation).

--

--
Ticket URL: <https://code.djangoproject.com/ticket/34477#comment:1>

Django

unread,
Apr 9, 2023, 7:06:16 AM4/9/23
to django-...@googlegroups.com
#34477: Asyncio send mail backend
-------------------------------------+-------------------------------------
Reporter: Andrew Chen Wang | Owner: Andrew
| Chen Wang
Type: New feature | Status: assigned

Component: Core (Mail) | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Andrew Chen Wang
* needs_better_patch: 0 => 1
* status: new => assigned
* stage: Unreviewed => Accepted


Comment:

Accepted based on
[https://github.com/django/deps/blob/main/accepted/0009-async.rst#email
DEP-9].

--
Ticket URL: <https://code.djangoproject.com/ticket/34477#comment:2>

Django

unread,
Aug 1, 2023, 8:05:44 AM8/1/23
to django-...@googlegroups.com
#34477: Asyncio send mail backend
-------------------------------------+-------------------------------------
Reporter: Andrew Chen Wang | Owner: Andrew
| Chen Wang
Type: New feature | Status: assigned
Component: Core (Mail) | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0

-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* easy: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/34477#comment:3>

Django

unread,
Jul 17, 2025, 3:08:56 AMJul 17
to django-...@googlegroups.com
#34477: Asyncio send mail backend
-------------------------------------+-------------------------------------
Reporter: Andrew Chen Wang | Owner: Ahmed
| Ibrahim
Type: New feature | Status: assigned
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ahmed Ibrahim):

* cc: Ahmed Ibrahim (added)
* has_patch: 0 => 1
* needs_tests: 1 => 0
* owner: Andrew Chen Wang => Ahmed Ibrahim
* version: 4.2 => dev

Comment:

I will handle this since it became inactive and I think it's a neat
feature
--
Ticket URL: <https://code.djangoproject.com/ticket/34477#comment:4>

Django

unread,
Jul 17, 2025, 3:09:13 AMJul 17
to django-...@googlegroups.com
#34477: Asyncio send mail backend
-------------------------------------+-------------------------------------
Reporter: Andrew Chen Wang | Owner: Ahmed
| Ibrahim
Type: New feature | Status: assigned
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ahmed Ibrahim):

* has_patch: 1 => 0
* needs_better_patch: 1 => 0
* needs_docs: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/34477#comment:5>

Django

unread,
Jul 20, 2025, 11:32:06 AMJul 20
to django-...@googlegroups.com
#34477: Asyncio send mail backend
-------------------------------------+-------------------------------------
Reporter: Andrew Chen Wang | Owner: Ahmed
| Ibrahim
Type: New feature | Status: assigned
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Ahmed Ibrahim):

Would it be better if I leave the sync implementations as is, and add a
new async implementation, because I my mind tells that we can create the
async and use the async to create a new sync handler with `sync_to_async`
so that the logic is only in one place
--
Ticket URL: <https://code.djangoproject.com/ticket/34477#comment:6>

Django

unread,
Jul 24, 2025, 2:24:21 PMJul 24
to django-...@googlegroups.com
#34477: Asyncio send mail backend
-------------------------------------+-------------------------------------
Reporter: Andrew Chen Wang | Owner: Ahmed
| Ibrahim
Type: New feature | Status: assigned
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mike Edmunds):

* cc: Mike Edmunds (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/34477#comment:7>

Django

unread,
Jul 24, 2025, 2:39:11 PMJul 24
to django-...@googlegroups.com
#34477: Asyncio send mail backend
-------------------------------------+-------------------------------------
Reporter: Andrew Chen Wang | Owner: Ahmed
| Ibrahim
Type: New feature | Status: assigned
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mike Edmunds):

Replying to [comment:6 Ahmed Ibrahim]:
> Would it be better if I leave the sync implementations as is, and add a
new async implementation, because I my mind tells that we can create the
async and use the async to create a new sync handler with `sync_to_async`
so that the logic is only in one place

My instinct is that each EmailBackend should decide for itself whether to
implement `send_messages()`, `asend_messages()`, or both. And then
''maybe'' the BaseEmailBackend implementation could `sync_to_async` or
`async_to_sync` if a subclass only provides one of them. (But I'd need to
think some more about what happens if an existing sync send method gets
asyncified.)
--
Ticket URL: <https://code.djangoproject.com/ticket/34477#comment:8>
Reply all
Reply to author
Forward
0 new messages