Using SparkPost with Django

April 29, 2017 Contributors

Note: this article covers using SparkPost via SMTP with Django. We also offer a Python client library that includes a Django email backend.

The simplest way to use SparkPost in your Django project is to configure its SMTP backend. To configure Django’s SMTP backend, put the following lines in your project’s settings.py file:

Remember to replace YOUR API KEY with an API key that has “Send via SMTP” permission. Follow the create API keys guide for detailed instructions.

Now send your email through Django using SparkPost:

Note that SMTP is the default backend for Django. However, if you want to make it explicit, put the following line in settings.py: