We have an email newsletter with about 40,000 subscribers. It is organised simply by a group. So everybody, who is member of this group gets the mailing (unless email is not on hold etc etc).

For the second time we have the issue, that nearly every recipient got the mailing twice. In one case 57 recipients got only one mail, in the other case 39. All the others got the same email two times.

People get upset by this, so I am quite interested in solving this issue.

What I can see, is that there are in both cases two jobs for the mailing, that are no tests. One is obiously a parent job and the other a child job. And all the mailing_event_queue entries belong to the child job.

All of this seems to be quite normal, because the other mailings look the same. The only strange thing is, that in these two cases the child job has nearly twice as much mailing_event_queue entries than recipients.

I only have access to log data of the second mailing, that has doubled sent mails. And in this case I found the anomaly, that the scheduled job, that sent this mailing reported "DB Error: constraint violation". And looking closer into this, it seems, that in between the time of selecting the recipients and sending the mail one recipient was deleted by an API call. Because of this the insert into the table mailing_event_queue failed because the foreign key for the email id, that was not longer found in the database.

Does any body have an idea, if there can be a connection between this error and sending the mailing to most of the recipients two times?

What should happen, if a email (or a contact and its email) get physically deleted between selection of recipients and sending of emails?

Is there an API version of deleting a contact, that takes care of this?

Or is it the process of sending the emails, that should take care of this?

  • what's civicrm version ? – Sunil Pawar Oct 31 '19 at 6:51
  • CiviCRM 7.x-5.17.4 / FlexMailer 1.1.0 with Drupal 7.67 – Harald Balluch Oct 31 '19 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.