1

I have a mailing group, which isn't a smart group, that always fails at 42%. I then add the successful ones to a group and resend the mailing and exclude that group. This then sends 32%. I repeat the above and the mailing is successful. This is the only mailing group on this site that is causing the problem and they send a lot of emails.

I check the logs and get this error:

"$Fatal Error Details = Array ( 
  [callback] => Array ( 
     [0] => CRM_Core_Error 
     [1] => exceptionHandler ) 
  [code] => -2 
  [message] => DB Error: syntax error 
  [mode] => 16 
  [debug_info] => SELECT a.id as `id`, a.name as `name` FROM civicrm_mailing a 
    WHERE (a.name LIKE "%success%") 
    ORDER BY a.is_archived, a.scheduled_date DESC 
    LIMIT 11 
    OFFSET -10 
  [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-10' at line 6] 
  [type] => DB_Error 
  [user_info] => SELECT a.id as `id`, a.name as `name` 
    FROM civicrm_mailing a 
    WHERE (a.name LIKE "%success%") 
    ORDER BY a.is_archived, a.scheduled_date DESC 
    LIMIT 11 
    OFFSET -10 
  [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-10' at line 6] 
  [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT a.id as `id`, a.name as `name` FROM civicrm_mailing a WHERE (a.name LIKE "%success%") ORDER BY a.is_archived, a.scheduled_date DESC LIMIT 11 OFFSET -10 [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-10' at line 6]"] 
)"

I then get a lot of errors around blank email body so skipping emails.

CiviMail will not send an empty mail body, Skipping: 

I have created a new group, added people to it and retested it with the same results.

Nothing obvious that I can see is causing the problem so I am at a loss to resolve it.

Cheers Bari

Backtrace:

  `$backTrace = 
  #0 /home/Site/public_html/sites/all/modules/civicrm/CRM/Core/Error.php(915): CRM_Core_Error::backtrace("backTrace", TRUE) 
  #1 /home/Site/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error)) 
  #2 /home/Site/public_html/sites/all/modules/civicrm/packages/DB.php(998): PEAR_Error->__construct("DB Error: syntax error", -2, 16, (Array:2), "SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...") 
  #3 /home/Site/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-2, 16, (Array:2), "SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...") 
  #4 /home/Site/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -2, 16, (Array:2), "SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...", "DB_Error", TRUE) 
  #5 /home/Site/public_html/sites/all/modules/civicrm/packages/DB/common.php(1925): PEAR->__call("raiseError", (Array:7)) 
  #6 /home/Site/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(935): DB_common->raiseError(-2, NULL, NULL, "SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...", "1064 ** You have an error in your SQL syntax; check the manual that correspon...") 
  #7 /home/Sitepublic_html/sites/all/modules/civicrm/packages/DB/mysqli.php(405): DB_mysqli->mysqliRaiseError() 
  #8 /home/Site/public_html/sites/all/modules/civicrm/packages/DB/common.php(1231): DB_mysqli->simpleQuery("SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...") 
  #9 /home/Site/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(2696): DB_common->query("SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...") 
  #10 /home/Site/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(1829): DB_DataObject->_query("SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...") 
  #11 /home/Site/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(421): DB_DataObject->query("SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...") 
  #12 /home/Site/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(1408): CRM_Core_DAO->query("SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...", TRUE) 
  #13 /home/Site/public_html/sites/all/modules/civicrm/Civi/API/SelectQuery.php(127): CRM_Core_DAO::executeQuery("SELECT a.id as `id`, a.name as `name`\nFROM civicrm_mailing a\nWHERE (a.name ...") 
  #14 /home/Site/public_html/sites/all/modules/civicrm/api/v3/utils.php(1260): Civi\API\SelectQuery->run() 
  #15 /home/Site/public_html/sites/all/modules/civicrm/api/v3/Mailing.php(238): _civicrm_api3_basic_get("CRM_Mailing_BAO_Mailing", (Array:8), TRUE, "Mailing") 
  #16 /home/Site/public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_mailing_get((Array:8)) 
  #17 /home/Site/public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(150): Civi\API\Provider\MagicFunctionProvider->invoke((Array:8)) 
  #18 /home/Site/public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest((Array:8)) 
  #19 /home/Site/public_html/sites/all/modules/civicrm/api/api.php(131): Civi\API\Kernel->runSafe("mailing", "get", (Array:8)) 
  #20 /home/Site/public_html/sites/all/modules/civicrm/api/v3/Generic/Getlist.php(39): civicrm_api3("mailing", "get", (Array:8)) 
  #21 /home/Site/public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(85): civicrm_api3_generic_getList((Array:8)) 
  #22 /home/Site/public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(150): Civi\API\Provider\MagicFunctionProvider->invoke((Array:8)) 
  #23 /home/Site/public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest((Array:8)) 
  #24 /home/Site/public_html/sites/all/modules/civicrm/api/api.php(22): Civi\API\Kernel->runSafe("Mailing", "getlist", (Array:6)) 
  #25 /home/Site/public_html/sites/all/modules/civicrm/CRM/Utils/REST.php(300): civicrm_api("Mailing", "getlist", (Array:6)) 
  #26 /home/Site/public_html/sites/all/modules/civicrm/CRM/Utils/REST.php(550): CRM_Utils_REST::process((Array:3), (Array:6)) 
  #27 /home/Site/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(277): CRM_Utils_REST::ajax() 
  #28 /home/Site/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:12)) 
  #29 /home/Site/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3)) 
  #30 /home/Site/public_html/sites/all/modules/civicrm/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:3)) 
  #31 /home/Site/public_html/includes/menu.inc(527): civicrm_invoke("ajax", "rest") 
  #32 /home/Site/public_html/index.php(21): menu_execute_active_handler() 
  #33 {main}"`
  • So it doesn't like "OFFSET -10". Do the logs also show the backtrace of the code resulting in the error? – Aidan Jun 11 at 8:12
  • Added backtrace, not very good formatting, I need to learn this! – Barijohn Jun 11 at 8:23
  • Just throw in some line breaks and spaces at the start of lines ::-) – Aidan Jun 11 at 16:24
3

Resolved this by creating a new email template, it seems as if something in the template was causing the problem.

No idea what, but this was the way we fixed the issue.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.