Advocacy for Email-01 (email backends)

3 views
Skip to first unread message

Russell Keith-Magee

unread,
Oct 25, 2009, 3:22:27 AM10/25/09
to Django Developers
Hi all,

The v1.2 votes are in, and it appears that Email-01 (introducing an
email backend API) needs some more discussion.

I am in complete agreement that Django shouldn't try to become an
email framework. That isn't the intention of this proposal.

The intention is to fix a specific problem that exists for supporting
sandboxed deployment environments, and AppEngine in particular.

AppEngine doesn't provide an SMTP server - the AppEngine sandbox
provides a specific API for sending email, rather than the standard
Python mail API. This is a problem because because Django provides an
API for sending email - and uses that API internally:

* contrib.auth sends mail as part of the password reset process
* contrib.comments sends mail as part of the comment moderation process
* the 500 handler sends mail to site admins
* the CommonMiddleware sends mail on broken links to site managers

If we're going to fully support AppEngine (and any other sandboxed
deployment platform), we need to provide a way to direct Django's
email APIs to APIs provided by a sandbox.

As a side effect, providing email an backend API cleans up a few other
minor lingering issues:

- It cleans up the monkeypatching required by the test framework,
since emails can be easily redirected to an in-memory backend during
test execution.

- It provides an easy way to debug email sending on the development
server. An 'email test server' was proposed - and ultimately rejected
- for v1.1. A 'console' email backend resolves this problem by
providing a way to direct email to stdout, rather than SMTP.

- It provides an elegant entry point for tools like django-mailer.
The email backend API would allow django-mailer to become a specialist
external email backend. This allows for greater decoupling: apps can
just call the Django mail api, rather than needing to specifically
provide django-mailer support.

I felt an email backend API would be an elegant way to gain a lot of
flexibility, with essentially no impact for existing users. The
original django-dev discussion [1] didn't raise much dissent - but the
voting process has shown that there is obviously some disagreement.

I'm keen to see a resolution to this problem. To that end, I'm
interested in hearing specific criticisms or concerns with the current
backend proposal. I'm also interested in any alternate approaches to
this problem.

[1] http://groups.google.com/group/django-developers/browse_thread/thread/ad0e5b2a8fd1ffe4

Yours,
Russ Magee %-)

Russell Keith-Magee

unread,
Oct 30, 2009, 8:10:19 AM10/30/09
to Django developers

On Oct 25, 3:22 pm, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> [1]http://groups.google.com/group/django-developers/browse_thread/thread...

I'm still keen to see a resolution to this problem. Can anyone -
especially those that voted -0 or -1 - offer any feedback?

Yours,
Russ Magee %-)

Luke Plant

unread,
Oct 30, 2009, 10:58:38 AM10/30/09
to django-d...@googlegroups.com
On Sunday 25 October 2009 07:22:27 Russell Keith-Magee wrote:

> I'm keen to see a resolution to this problem. To that end, I'm
> interested in hearing specific criticisms or concerns with the
> current backend proposal. I'm also interested in any alternate
> approaches to this problem.

I'm completely fine on this proposal. Apparently I voted '-0', I'm
not sure precisely why as I didn't leave any specific comment, but I
would change that to +0 now (I have no specific need for it myself,
but can see that it's an important improvement for lots of people, and
it can be implemented cleanly).

I presume that the only built-in email backends would be the existing
SMTP one, one for testing (which is just a code shuffle really), and a
'write to standard out' one for debugging (which is trivial and
completely un-critical anyway), so this doesn't really add any
maintenance burden to Django.

Regards,

Luke

--
A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete
fools. -- Douglas Adams

Luke Plant || http://lukeplant.me.uk/

Alex Gaynor

unread,
Oct 30, 2009, 11:03:06 AM10/30/09
to django-d...@googlegroups.com
Amusingly it appears that since Jannis got his wings^H^H^H^H^H^H
commit bit his -1 became a veto :)

Alex

--
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

Andi Albrecht

unread,
Oct 30, 2009, 11:15:32 AM10/30/09
to django-d...@googlegroups.com
On Fri, Oct 30, 2009 at 4:03 PM, Alex Gaynor <alex....@gmail.com> wrote:
>
> On Fri, Oct 30, 2009 at 10:58 AM, Luke Plant <L.Pla...@cantab.net> wrote:
>>
>> On Sunday 25 October 2009 07:22:27 Russell Keith-Magee wrote:
>>
>>> I'm keen to see a resolution to this problem. To that end, I'm
>>> interested in hearing specific criticisms or concerns with the
>>>  current backend proposal. I'm also interested in any alternate
>>>  approaches to this problem.
>>
>> I'm completely fine on this proposal.  Apparently I voted '-0', I'm
>> not sure precisely why as I didn't leave any specific comment, but I
>> would change that to +0 now (I have no specific need for it myself,
>> but can see that it's an important improvement for lots of people, and
>> it can be implemented cleanly).
>>
>> I presume that the only built-in email backends would be the existing
>> SMTP one, one for testing (which is just a code shuffle really), and a
>> 'write to standard out' one for debugging (which is trivial and
>> completely un-critical anyway), so this doesn't really add any
>> maintenance burden to Django.

Currently there are two more backend implementation in the proposal: A
dummy backend that does nothing and a backend that writes to message
to the file system.

>>
>> Regards,
>>
>> Luke
>>
>> --
>> A common mistake that people make when trying to design something
>> completely foolproof is to underestimate the ingenuity of complete
>> fools.  -- Douglas Adams
>>
>> Luke Plant || http://lukeplant.me.uk/
>>
>> >
>>
>
> Amusingly it appears that since Jannis got his wings^H^H^H^H^H^H
> commit bit his -1 became a veto :)

Would be nice to hear from Janis how django-mailer could be extended
to support different backends then. :)

Jannis Leidel

unread,
Oct 30, 2009, 11:30:42 AM10/30/09
to django-d...@googlegroups.com
>>> I'm keen to see a resolution to this problem. To that end, I'm
>>> interested in hearing specific criticisms or concerns with the
>>> current backend proposal. I'm also interested in any alternate
>>> approaches to this problem.
>
> Amusingly it appears that since Jannis got his wings^H^H^H^H^H^H
> commit bit his -1 became a veto :)

My original reaction was based on the experience with django-mailer
which I believe could also have been used as a Petri dish for
developing pluggable email backends. I also talked to Andi about that
during Froscon and agreed about the general need for a more extensible
email system.

Regarding the voting, I'm more -0 now in the light of the other
advantages a tighter intergration with Django would bring.

Jannis

Brian Rosner

unread,
Nov 2, 2009, 10:37:37 AM11/2/09
to django-d...@googlegroups.com

On Oct 30, 2009, at 6:10 AM, Russell Keith-Magee wrote:

> I'm still keen to see a resolution to this problem. Can anyone -
> especially those that voted -0 or -1 - offer any feedback?

I've reviewed the RC patch on #10355. Overall, I am okay with it. I
hadn't kept up with with many of the details of the original proposal
and was afraid of over-complication. Thanks for putting in the work to
get this ready for commit, Russell.

Brian Rosner
http://oebfare.com
http://twitter.com/brosner

Reply all
Reply to author
Forward
0 new messages