[Zope3-dev] SMTP Service

Barry Warsaw barry@zope.com
22 Apr 2003 10:48:53 -0400


On Tue, 2003-04-22 at 10:01, Steve Alexander wrote:

> Yep. We need a "Sending mail out" service.

Stephan and I have irc'd a bit about this, and he checked a bunch of
interfaces in.  I have a modified set of interfaces sitting in one of my
checkouts, which clean up some things and describe a little closer my
own thinking about such a service.

> I think an SMTP Service for Zope 3 should be a global service, and 
> should be configured per-process by ZConfig.

+1

> So, if I have several ZEO storage clients in different locations, each 
> can be configured to use an SMTP server that is local to its process.

Or not local, but it shouldn't matter to the clients.  E.g. it should be
possible to configure a front-end to a smurf farm for really high
throughput mail applications.  In general, I think Zope products
shouldn't care much (although there may be some facility for requesting
levels of service).  For example, a client usually should not have to
provide hostname and port numbers, and normally shouldn't have to
provide authentication information.  The dead-simple api ought to
require just the sender, the list of recips, and the message text. 
Higher level apis might provide envelope information (if it's different
than the header From and To), and could perhaps require an
email.Message.Message instance.

> Ideally and SMTP service should work "transactionally", so that mail is 
> only sent out on a successfully committed transaction.

Good point, although that probably isn't an aspect that can be captured
in the interface, except by docstring.

> It should be queued, so that sending the mail out need not be completed 
> before the transaction is completed. 

Absolutely.

> Pending mail could be cached on the 
> filesystem using a MailDir-style system to make things work 
> transactionally, and to make things recoverable when bad things happen.

Yep, maildir is a very nice on-disk representation.  Again, that's
probably hidden from the interface though.

> The API for the SMTP Service should have two parts: A "dead simple" API 
> for use from simple scripts that offers the simple things people most 
> often need.
> Also, a "complete" API that looks a lot like the 'email' package from 
> the Python standard library.

I'm not sure what you mean by the latter.  Why not just use the email
package?

> It might be nice to allow the default SMTP Service to be replaced with 
> one that uses MailMan for sending mail, and also has ZConfig options to 
> make this easy.

Yep.  Note that to hand off a message to Mailman wouldn't require a trip
through smtp.  It's all Python after all and there's a neat way to
inject a message into Mailman's queues going through Python.  That's why
the dead-simple api probably doesn't need to specify hostname and port
numbers.

I hope I'll have time to work on this, but at least I'll try to stay
involved in the discussions. :/

-Barry