Opened 2 years ago

Last modified 6 weeks ago

#34477 assigned New feature

Asyncio send mail backend

Reported by: Andrew Chen Wang Owned by: Ahmed Ibrahim
Component: Core (Mail) Version: dev
Severity: Normal Keywords:
Cc: Ahmed Ibrahim, Mike Edmunds Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Andrew Chen Wang)

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).

Change History (8)

comment:1 by Andrew Chen Wang, 2 years ago

Description: modified (diff)
Needs documentation: set
Needs tests: set

comment:2 by Mariusz Felisiak, 2 years ago

Owner: changed from nobody to Andrew Chen Wang
Patch needs improvement: set
Status: newassigned
Triage Stage: UnreviewedAccepted

Accepted based on DEP-9.

comment:3 by Mariusz Felisiak, 2 years ago

Easy pickings: unset

comment:4 by Ahmed Ibrahim, 7 weeks ago

Cc: Ahmed Ibrahim added
Has patch: set
Needs tests: unset
Owner: changed from Andrew Chen Wang to Ahmed Ibrahim
Version: 4.2dev

I will handle this since it became inactive and I think it's a neat feature

comment:5 by Ahmed Ibrahim, 7 weeks ago

Has patch: unset
Needs documentation: unset
Patch needs improvement: unset

comment:6 by Ahmed Ibrahim, 6 weeks ago

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

comment:7 by Mike Edmunds, 6 weeks ago

Cc: Mike Edmunds added

in reply to:  6 comment:8 by Mike Edmunds, 6 weeks ago

Replying to 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.)

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