If I send a message via the SparkPost python API directly, it returns a result that looks like this:
{'total_rejected_recipients': 0, 'total_accepted_recipients': 1, 'id': '1234567890'}
Django has built-in integration support for sending mail via sparkpost, if you set MAIL_BACKEND
in settings.py
:
EMAIL_BACKEND = 'sparkpost.django.email_backend.SparkPostEmailBackend'
SPARKPOST_API_KEY = 'something'
Does Django offer a way to access the API result when using the standard Django mail methods? (the send_mail()
function or the EmailMessage
class)
It looks like it doesn't.
The source code shows that
SparkPostEmailBackend.send_messages()
obtains a response but does not store it anywhere:Maybe you can create your custom email backend that extends from
SparkPostEmailBackend
and overrides thesend_messages()
.