[Zope-dev] Retry Fixes for zope.sendmail

Marius Gedminas mgedmin at b4net.lt
Tue Jan 22 20:10:50 EST 2008


On Mon, Jan 21, 2008 at 02:15:24PM +1300, Matthew Grant wrote:
> During the last few days I have been doing some fixes for zope.sendmail
> to do with the trouble we are having with it on our Zope 3 application,
> which actually sends a lot of emails.

Yay!

> Problems I in the fix are:
> 
> 1) Handling of SMTP error 451 etc.
> 2) Cleaning stale lock links out of the queue
> 3) Handling Server disconnection
> 4) Handling of connect() failure
> 5) A bit of a clean up QueueProcessorThread so that it complies with
> IMailQueueProcessor in interfaces.py

I think the IMailQueueProcessor interface should be removed altogether.
It's not used anywhere, and I don't see how it could be useful.
IMailEvent and subinterfaces should also go.

zope.sendmail (which began life as zope.app.mail) started from a design
sketch in interfaces.py.  After several years of actual use, I think it
makes more sense to make interfaces match the reality than to try and
complete the initial sketch.

> Events 1, 3 and 4 are handled by waiting for 5 minutes, and then
> restarting processing.

There are also SMTP errors from the 5xx range that should be handled by
dropping the message (or generating a bounce).  Otherwise zope.sendmail
will try to submit the same message with the same ill-formed e-mail
address forever.

This is rapidly becoming a full Mail Transport Agent.

The original idea was for Zope 3 to hand off the email to a real MTA as
soon as possible, via /usr/sbin/sendmail or via SMTP to localhost:25, to
avoid the necessity of reimplementing a fully-featured queue processor in
Zope 3 itself.  /usr/sbin/sendmail integration was stripped after an
embarrassing security problem with command-line argument quoting (or,
rather, the lack of it).  Perhaps it's time to reimplement it, this time
using Python 2.4's subprocess module?  It ought to be more reliable than
speaking SMTP to a local MTA.

> I would appreciate hearing from the zope.sendmail developers.  Once I
> have the code complete I will gladly post a diff tomorrow.

I wrote parts of zope.sendmail (the old and buggy parts, mostly).  A Cc:
on the diff would be appreciated.

Marius Gedminas
-- 
"Only wimps use tape backup: _real_ men just upload their important stuff
on ftp, and let the rest of the world mirror it ;)"
(Linus Torvalds, about his failing hard drive on linux.cs.helsinki.fi)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20080123/d48db094/attachment.bin


More information about the Zope-Dev mailing list