djangoemaildockersmtpdjango-1.11

Docker SMTP Server for Django Container SMTP backend


I am looking to have one of my django docker containers setup a smtp backend so I can send input from a contact form to a gmail address as well as possibly send out an email when someone puts in their email to subscribe for updates: https://docs.djangoproject.com/en/1.11/topics/email/#smtp-backend

How do I go about setting up the SMTP server? Is it a separate docker container? How do I set it up?


Solution

  • The email backend is just an imported module. You can just use it like it is described in the docs: https://docs.djangoproject.com/en/1.11/topics/email/#email-backends

    Before that, you have to configure the data for the smtp server. You just have to configure the settings, like your smtp host, username and password, etc. Here are the docs to configure it: https://docs.djangoproject.com/en/1.11/topics/email/#smtp-backend You can use an existing smtp server. If you have a package with a domain you probably have a an email account included.

    There is no need for another container. But you can setup your own in a a separate container. There are already some docker-ready solutions present. Here are a few: