Execution of queue is stopped when an SMTPRecepientRefuse is encountered

Bug #319115 reported by G. Gozadinos
6
Affects Status Importance Assigned to Milestone
Singing & Dancing
New
Undecided
Daniel Nouri

Bug Description

If an adress that does exist is inside the recipient list (which can occur for instance if the csv imported has such entries, or if a domain or email adress expires) an SMTPRecepientRefuse exception is thrown. In which case delivery stops. I would think it should continue and maybe even remove the bad entry.

Revision history for this message
Daniel Nouri (daniel.nouri) wrote :

Can you provide a traceback?

Changed in singing-dancing:
assignee: nobody → daniel.nouri
Revision history for this message
G. Gozadinos (ggozadinos) wrote :

Of course ;) I replaced domain and email adress with asterisks...

2009-01-21 10:37:23 CRITICAL txn.1123420496 A storage error occurred during the second phase of the two-phase commit. Resources may be in an inconsistent state.
2009-01-21 10:37:23 ERROR Zope.SiteErrorLog http://***/portal_newsletters/channels/newsletter-stats.html
Traceback (innermost last):
  Module ZPublisher.Publish, line 125, in publish
  Module Zope2.App.startup, line 238, in commit
  Module transaction._manager, line 96, in commit
  Module transaction._transaction, line 395, in commit
  Module transaction._transaction, line 503, in _commitResources
  Module zope.sendmail.delivery, line 78, in tpc_finish
  Module collective.dancing.composer, line 413, in send
  Module zope.sendmail.mailer, line 45, in send
  Module smtplib, line 695, in sendmail
SMTPRecipientsRefused: {u'***@***': (450, '4.1.2 <***@***>: Recipient address rejected: Domain not found')}

Revision history for this message
yboussard (y-boussard-ingeniweb) wrote :

Hello,

I notice exactly the same problem. If there is an STMTP exception raised the process queue stop but dispatch is not notice of that.
In http://svn.plone.org/svn/collective/collective.singing/trunk/collective/singing/message.py the try, catch doesn't work in that case because of the architecture of zope.sendmail I guess.
I think that collective.dancing.composer.SMTPMailer.send must have an try, cache in that case.
Exception in smtplib are :

"SMTPException","SMTPServerDisconnected","SMTPResponseException",
           "SMTPSenderRefused","SMTPRecipientsRefused","SMTPDataError",
           "SMTPConnectError","SMTPHeloError","SMTPAuthenticationError",

SMTPRecipientsRefused and SMTPSenderRefused are not critical error for the dispatch process and I think they can be catch in the SMTPMailer.
In my case , recipients received hundred message of the same newsletter because the queue failed of a empty email address. The queue is never purge and the @@dancing.utils/tick_and_dispatch finish by blocking zope server.

The traceback :

INFO collective.singing Dispatching is locked by another process.
CRITICAL txn.16292 A storage error occurred during the second phase of the two-phase commit. Resources may be in an inconsistent state.

2009-05-25T09:48:09 ERROR Zope.SiteErrorLog .../@@dancing.utils/tick_and_dispatch

Traceback (innermost last):

  Module ZPublisher.Publish, line 125, in publish

  Module Zope2.App.startup, line 238, in commit

  Module transaction._manager, line 96, in commit

  Module transaction._transaction, line 395, in commit

  Module transaction._transaction, line 503, in _commitResources

  Module zope.sendmail.delivery, line 87, in tpc_finish

  Module collective.dancing.composer, line 376, in send

  Module zope.sendmail.mailer, line 72, in send

  Module smtplib, line 695, in sendmail

SMTPRecipientsRefused: {}

Thanks for your work !
Regards Youenn

Revision history for this message
Daniel Nouri (daniel.nouri) wrote :

I would assume that queuedDelivery does not suffer from this problem.

http://pypi.python.org/pypi/collective.dancing#configuring-zope-sendmail-to-send-out-messages

Patches happily accepted.

Revision history for this message
kalymero (antonio-sagliocco) wrote :

I tried to reproduce this issue and it seems to work.

I injected the exception in the __call__ method of collective.singing.mail.Dispatch class

------------------------
from smtplib import SMTPRecipientsRefused
if '<email address hidden>' not in self._split(msg['To']):
    raise SMTPRecipientsRefused('-> SMTPRecipientsRefused raised <-')
-------------------

and all goes fine. An email was correctly delivered to "<email address hidden>", all other mails correcty failed.

Any idea?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.