SMTP configuration in a dict

122 views
Skip to first unread message

Julian Wachholz

unread,
May 28, 2014, 7:06:00 AM5/28/14
to django-d...@googlegroups.com
Hi django-developers

I'd like to propose a relatively small change to the way we configure our SMTP email backends.
Up until now, configuring your SMTP backend took up to 6 individual settings, ranging from EMAIL_HOST to EMAIL_USE_SSL etc.

We already have a dictionary to configure things like caches and databases, so why not for sending email (at least with the SMTP backend).
I've already created a POC branch complete with docs and deprecation warnings here: https://github.com/julianwachholz/django/tree/feature/12factor-smtp

Please let me know what you think!

Cheers
Julian

PS: This change is only so altruistic, as it would enable me to include email settings in my dj-database-url fork (https://github.com/julianwachholz/dj-config-url).

Tim Graham

unread,
May 28, 2014, 7:22:56 AM5/28/14
to django-d...@googlegroups.com
Ramiro tried to do something similar, moving the cookie settings to a dictionary, see #21051, but gave up due to backwards compatibility concerns. Not saying it's impossible, but it may be a bit trickier than it looks at first.

Andi Albrecht

unread,
May 28, 2014, 7:23:58 AM5/28/14
to django-d...@googlegroups.com
Hi,

On Wed, May 28, 2014 at 1:06 PM, Julian Wachholz <rcra...@gmail.com> wrote:
> Hi django-developers
>
> I'd like to propose a relatively small change to the way we configure our
> SMTP email backends.
> Up until now, configuring your SMTP backend took up to 6 individual
> settings, ranging from EMAIL_HOST to EMAIL_USE_SSL etc.
>
> We already have a dictionary to configure things like caches and databases,
> so why not for sending email (at least with the SMTP backend).
> I've already created a POC branch complete with docs and deprecation
> warnings here:
> https://github.com/julianwachholz/django/tree/feature/12factor-smtp
>
> Please let me know what you think!

I've came across this too while working on
https://code.djangoproject.com/ticket/20743 (add support for ssl
keyfile/certfile). If support for keyfile/certfile would be added two
additional settings for the SMTP backend would be required to
configure the file paths.

The current settings for emails is confusing IMO since some settings
are for emails in general (EMAIL_BACKEND, EMAIL_SUBJECT_PREFIX) and
others are backend related (EMAIL_FILE_PATH for the file backend,
several others for the SMTP backend).

IMO it's a good idea to make it clear which settings belong to which
backend and a dictionary-based solution sounds good to me.

--
Andi

>
> Cheers
> Julian
>
> PS: This change is only so altruistic, as it would enable me to include
> email settings in my dj-database-url fork
> (https://github.com/julianwachholz/dj-config-url).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-develop...@googlegroups.com.
> To post to this group, send email to django-d...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/3ed1fa0e-8676-412e-8265-aaa196465ffb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Aymeric Augustin

unread,
May 28, 2014, 4:29:25 PM5/28/14
to django-d...@googlegroups.com
Still, it's a good idea, please file a Trac ticket if there isn't one already.

-- 
Aymeric.
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.

Julian Wachholz

unread,
May 30, 2014, 3:05:39 AM5/30/14
to django-d...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages