File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,4 @@ done with Anymail:
1212 django_templates
1313 securing_webhooks
1414 test_backend
15-
16- .. TODO:
17- .. Working with django-mailer(2)
18- .. Sharing backend connections (sessions)
19-
15+ performance
Original file line number Diff line number Diff line change 1+ .. _performance :
2+
3+ Batch send performance
4+ ======================
5+
6+ If you are sending batches of hundreds of emails at a time, you can improve
7+ performance slightly by reusing a single HTTP connection to your ESP's
8+ API, rather than creating (and tearing down) a new connection for each message.
9+
10+ Most Anymail EmailBackends automatically reuse their HTTP connections when
11+ used with Django's batch-sending functions :func: `~django.core.mail.send_mass_mail ` or
12+ :meth: `connection.send_messages `. See :ref: `django:topics-sending-multiple-emails `
13+ in the Django docs for more info and an example.
14+
15+ (The exception is when Anymail wraps an ESP's official Python package, and that
16+ package doesn't support connection reuse. Django's batch-sending functions will
17+ still work, but will incur the overhead of creating a separate connection for each
18+ message sent. Currently, only SparkPost has this limitation.)
19+
20+ If you need even more performance, you may want to consider your ESP's batch-sending
21+ features. When supported by your ESP, Anymail can send multiple messages with a single
22+ API call. See :ref: `batch-send ` for details, and be sure to check the
23+ :ref: `ESP-specific info <supported-esps >` because batch sending capabilities vary
24+ significantly between ESPs.
You can’t perform that action at this time.
0 commit comments