Skip to content

Django Dynamic Email Settings

Posted on:December 10, 2017

Django Dynamic Email Settings

I build a lot of projects in Django, and there are very few projects around that don’t need the ability to send email to some capacity.

In the past, I’ve been copying and pasting a very simple custom EmailBackend that I created and with the help of django-solo, integrated into the admin panel so you can edit email settings like hostname, username and password, etc. straight from the Django admin panel.

The Package

After using it successfully for so long, I decided it was time to create a reusable Django app so other people can use it, as well as to simplify the integration of the tool into future projects that I build. The result is django-des, or Django Dynamic Email Settings. A small reusable app that does this all for you. I’m very happy with the result:

Django Dynamic Email Settings

How it works

Django DES works by providing a Django Admin integration and a custom email backend called the ConfiguredEmailBackend. Whenever a message is sent, a backend is instantiated for the connection. The ConfiguredEmailBackend retrieves settings set by the user in the Django Admin panel before sending the email.

One thing worth mentioning is the order of preferences. If something is set in the admin panel, provided in, and passed in as a kwarg to the ConfiguredEmailBackend constructor, the precedence of those settings is as follows, from highest to lowest


The primary goal of this project was to create a simple and interactive way to configure email. Often it takes a few tries to get that first test email sent, and


You can now visit and configure your SMTP email settings and send a test email.

Future Features

I’d like to support the option to upload your SSL keyfile and SSL certfile directly to the admin panel, as the Use SSL setting isn’t very helpful without it, since you will still need to configure the key and cert in

Obviously, there are some security considerations to be made here. How to I manage the permissions of the certfiles to only allow authorized processes and users to access them? How to I ensure they aren’t exposed via a user’s static or media file configuration? Once I have an answer here, I might add this feature. If you’ve got that answer, feel free to open a pull request!