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

Attachment: aftercommit.diff
Description: Binary data

Attachment: beforecommit.diff
Description: Binary data

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to