[Zope-dev] zope.sendmail and critical transaction errors.

Matthew Wilkes matthew at matthewwilkes.co.uk
Wed Jun 30 06:43:18 EDT 2010


On 2010-06-23, at 1359, Laurence Rowe wrote:

> I think the Before Commit Hook option is probably best here.
> DirectMailDelivery should only be used for testing anyway, or at least
> only on very small sites in production - QueuedMailDelivery will scale
> better.

Sorry, I'm somewhat late to this thread, in the process of moving to Germany and missed it.

I've committed some partial fixes that don't rely on using transaction hooks:

- Products.MailHost now no longer duplicates code in zope.sendmail
- zope.sendmail mailers grow a vote() method to allow them to veto transactions if they know they'll fail.  Currently SMTPMailer will go as far as HELO before accepting the vote.
- All exceptions in tpc_finish are redirected to the log instead of being raised

This is similar to what Wichert described, the upshot is that missing and non-connectable servers cause a transaction abort but deeper problems can fail part-way through sending the emails (as currently happens) but without breaking the ZODB contracts.

It has been suggested on IRC that we should also have an event fire on failed mail sending so applications can display a message in the UI, which seems like a good idea. 

This obviously isn't perfect but it retains the basic functionality of sendmail as it is currently.

Matt


More information about the Zope-Dev mailing list