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

Laurence Rowe l at lrowe.co.uk
Wed Jun 23 07:59:50 EDT 2010


With Zope2's MailHost now using zope.sendmail, we're seeing some
critical errors when sending mail when the mail server domain name is
misconfigured. http://dev.plone.org/plone/ticket/10675 (these are
triggered by a password reset mail, the registration mail is sent
immediately).

This is because zope.sendmail.delivery.MailDataManager sends mail in
tpc_finish when using DirectMailDelivery. While MailDataManager makes
sense for QueuedMailDelivery (msg.commit should never fail) for
DirectMailDelivery it seems wrong.

To fix this, DirectMailDelivery should use a commit hook - there are
two options:

* After Commit Hook

  Ensures mail is only sent once in event of a request being retried,
but errors are swallowed so no feedback that there is a problem to the
browser.

* Before Commit Hook

  Mail me be sent multiple times in event of a request being retried
due to a conflict error, but errors propagate to the browser.


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.

For Zope 2.12 / Plone 4.0 we have the additional problem that Zope
2.12 is incompatible with zope.sendmail 3.7.x / trunk due to a
zope.component 3.8 dependency. I think this issue is serious enough to
warrant backporting this fix to the zope.sendmail 3.6.x branch.


Patches attached for comment.


Laurence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aftercommit.diff
Type: application/octet-stream
Size: 2346 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20100623/8972082b/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: beforecommit.diff
Type: application/octet-stream
Size: 2015 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20100623/8972082b/attachment-0001.obj 


More information about the Zope-Dev mailing list