Body: <p>This is a continuation of a problem I thought I had resolved earlier, <a href="https://civicrm.stackexchange.com/questions/35527/is-there-a-maximum-number-of-links-permitted-in-an-outbound-email">is there a maximum number of links permitted in an outbound email?</a></p>
  
  <p>I am using WordPress 5.4 and CiviCRM Version 5.18.4. I could not get CiviCRM to process even my test mailings of one particular message.  Eventually I simplified the message (reducing the number of links, as well as the length), and that seemed to work.</p>
  
  <p>I was then able to send the message out (as a bulk email, through CiviMail) to a small test group of 3 recipients, and that completed OK.  Then I tried sending it to a larger group of 9 recipients, and after about a minute I received a "DB Error: no database selected" error, suggesting the job didn't complete.  In fact, the mails DID go out to the 9 recipients, but they did NOT show up in their individual "Activity" lists, and the mailing still showed as Running.  And the next time the Send Mail job ran, it sent them out AGAIN.  That's not good.  </p>
  
  <p>I had my hosting service increase the amount of memory allocated to me (as suggested by another older question here).  It seemed to help at first, but now I am getting the same results.  </p>
  
  <p>What puzzles me is that it sends the mail but does not record the mailing to that contact before moving on to the next address.  Does CiviMail send out all the emails before recording any of them in the contact record?  That seems odd.  </p>
  
  <p>Mail reports do not help:  While the job is running, it does not show as either complete or Incomplete.  And after I cancel it (as I must), it still doesn't appear on the reports -- again, even though mail WAS sent.   </p>
  
  <p>Any suggestions?  </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-18T10:24:05.377Z
Comments.Text: We have seen a similar issue under Joomla where a CiviMail job fails to complete, and then restarts at the beginning, sending the same emails again.  We found a workaround was to set the Mailer Batch Size to five.  What is strange is that the mailer process doesn't record successful sent mail as it goes along.  I am minded to raise it as an issue, and possibly research how that might be changed.
Comments.UserDisplayName: Stephen Palmstrom
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-18T10:46:53.523Z
Comments.Text: Raised as issue https://lab.civicrm.org/dev/core/-/issues/1768
Comments.UserDisplayName: Stephen Palmstrom
Tags: <civimail>
Title: CiviMail mail job fails to complete, even though mail is sent
ThreadText: # CiviMail mail job fails to complete, even though mail is sent
  
  (Asked by: username_0 on 2020-05-05)
  
  This is a continuation of a problem I thought I had resolved earlier, [is there a maximum number of links permitted in an outbound email?](https://civicrm.stackexchange.com/questions/35527/is-there-a-maximum-number-of-links-permitted-in-an-outbound-email)
  
  I am using WordPress 5.4 and CiviCRM Version 5.18.4. I could not get CiviCRM to process even my test mailings of one particular message. Eventually I simplified the message (reducing the number of links, as well as the length), and that seemed to work.
  
  I was then able to send the message out (as a bulk email, through CiviMail) to a small test group of 3 recipients, and that completed OK. Then I tried sending it to a larger group of 9 recipients, and after about a minute I received a "DB Error: no database selected" error, suggesting the job didn't complete. In fact, the mails DID go out to the 9 recipients, but they did NOT show up in their individual "Activity" lists, and the mailing still showed as Running. And the next time the Send Mail job ran, it sent them out AGAIN. That's not good.
  
  I had my hosting service increase the amount of memory allocated to me (as suggested by another older question here). It seemed to help at first, but now I am getting the same results.
  
  What puzzles me is that it sends the mail but does not record the mailing to that contact before moving on to the next address. Does CiviMail send out all the emails before recording any of them in the contact record? That seems odd.
  
  Mail reports do not help: While the job is running, it does not show as either complete or Incomplete. And after I cancel it (as I must), it still doesn't appear on the reports -- again, even though mail WAS sent.
  
  Any suggestions?
  
  **Tags:** civimail
  
  > **Comments:**
  > **username_1**: We have seen a similar issue under Joomla where a CiviMail job fails to complete, and then restarts at the beginning, sending the same emails again.  We found a workaround was to set the Mailer Batch Size to five.  What is strange is that the mailer process doesn't record successful sent mail as it goes along.  I am minded to raise it as an issue, and possibly research how that might be changed.  
  > **username_1**: Raised as issue https://lab.civicrm.org/dev/core/-/issues/1768  
  
  ---
  
  ## 0 answers
  
  