I'm working for Engineers Without Borders Galicia and we are migrating our volunteer managing system to CiviCRM. I'm experiencing something quite like this bug: https://issues.civicrm.org/jira/browse/CRM-15702

I can send SMS to individuals from his profile page, but bulk SMS are not sent , although the report says the job is completed. The users in the group (a one man group) have all emails. Our SMS provider is Twilio and there is no trace of the bulk sms. The normal ones get perfectly sent (and logged).

Any help would be very much appreciated.

Iván Lago.

IT Engineer at Engineers Without Borders Galicia

More info: Server version: Apache/2.2.22 (Debian) CMS: Drupal 7.36 CiviCRM version:4.6.0 PHP: 5.4.39-0+deb7u2 MySQL: 5.5.41-0+wheezy1 SMS Provider: Twilio (test acount)

//Edit 1: As someone noticed at CiviCRM forums, there's no such version 5.6.0 . It was a typo fail that I've copy-pasted many times. Sorry about that. CiviCRM version is 4.6.0.

//Edit 2: To give more data, I'm forcing the process of sending pending sms with the call:

php /var/www/sites/all/modules/civicrm/bin/cli.php -u [myuser] -p [mypassword] -e Job -a execute

Obviously, with my user and password where necessary. The jobs get done... but no sms are ever sent :( .

  • I am having the same issue. I can send SMS messages to an individual but cannnot send bulk SMS messages' I get a SQL syntax error as shown in the backtrace below. $backTrace = #0 /var/www/test/sites/all/modules/civicrm/CRM/Core/Error.php(912): CRM_Core_Error::backtrace("backTrace", TRUE) #1 [internal function](): CRM_Core_Error::exceptionHandler(Object(DB_Error)) #2 /var/www/test/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error)) #3 /var/www/test/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, ( Jul 19, 2016 at 8:51

3 Answers 3


Hi I'm having this exact problem and have done some debugging:

When making a new SMS there are three steps

  1. you first select recipients
  2. then you write the body of the SMS
  3. you schedule the SMS

Between step one and two the table civicrm_mailing_recipients correctly gets filled with email_id set to null and phone_id set with the id of the contacts' phone numbers. This gets done in the function getRecipients in CRM/Mailing/BAO/Mailing.php, and the phone_ids get set because $mode is set to "sms".

But after completing step three this function is called again and $mode is now empty, and the email_id is set instead and phone_id is set to null.

This results in an empty result from an sql-call in the function deliver in CRM/Mailing/Bao/MailingJob.php, which try to get the recipients, but returns empty and thus there's no one to send to.

This second call to getRecipients is made by the function create, also in CRM/Mailing/BAO/Mailing.php, and it's there $mode is NOT getting set, and there's no checking if it's an sms or not:

  // Populate the recipients.
  if (empty($params['_skip_evil_bao_auto_recipients_'])) {
    self::getRecipients($job->id, $mailing->id, NULL, NULL, TRUE, $mailing->dedupe_email);

So to fix that I altered it to this:

  // Populate the recipients.
  if (empty($params['_skip_evil_bao_auto_recipients_'])) {
    // check if it's an sms
    $mode = $mailing->sms_provider_id ? 'sms' : NULL;
    self::getRecipients($job->id, $mailing->id, NULL, NULL, TRUE, $mailing->dedupe_email, $mode);

And now it works. When the "Send Scheduled SMS"-job is run, the bulk sms gets sent. I've filed an issue at https://issues.civicrm.org/jira/browse/CRM-17331


It is because you have a test account. If you go to a paid account, the issue will stop.



You must verify a phone number before you can send SMS messages
to it from your trial phone number.


Trial numbers can only call and text verified numbers.


2) Is it because I have a trial account and will it work once I upgrade? From an trial account You can send SMS to the number with you registered. To other numbers it will work after you upgrade your account.

  • The phone is verified. It's my own phone. I can open my profile and send myself an sms from the actions menu. I'm afraid that is not the problem. It the phone wasn't verified it would not allow individual messages either. And it does. The problem is in the bulk-sms. Apr 9, 2015 at 22:45
  • So you can send individual SMS to numbers/contacts other than yourself? When I first had a test account, I could only send to my mobile, not other contacts. When I got a paid account, I was then able to send to other mobile numbers. Apr 9, 2015 at 23:57
  • Yes I can. I've contacted them previously, verified each number and now I can send them SMS. If that were the problem Twilio API would have logged the petition and shown the error, but they don't even receive anything if I try to send a bulk-sms. Let's see if someone has as another idea but I really appreciate that you are trying to help. Thanks :). Apr 10, 2015 at 4:02
  • You bet! Hope you can sort it out soon. Apr 10, 2015 at 5:05

I experienced this myself, but understood that it was plenty of ways to run into the issue of not being able to send bulk-sms. Try to limit the issue first:

If it is in fact the same issue as I experienced, on the forum thread, then this will help you figure out what the issue is all about.

  1. Send a bulk sms with a template including a token, and an e-Mail adress recorded at the contact.

  2. Send a bulk sms with a template without any tokens, and an e-Mail adress recorded at the contact.

  3. Send a bulk sms with a template including a token, and no e-Mail adress recorded at the contact.

  4. Send a bulk sms with a template without any tokens, and no e-Mail adress recorded at the contact.

    1. And then possibly combinations where "No bulk e-mail" is ticked off.

There was submitted a fix for case 5 I think, but our issue actually was case 1, I think.

Good luck!

  • Well the good thing is that I can give you a quick response for all of the tests. None of them worked. :( Apr 10, 2015 at 17:08
  • @user2329051 Ok, then I suspect that the issue is different from those I experienced...
    – Flying
    Apr 10, 2015 at 17:53
  • @user2329051 just another thought... As I discovered, bulk sms is developed on the basis of the code of bulk mail. So in some cases they share both code and settings... Can you send bulk mail without any issues? The settings of CiviMail is sometimes influencing bulk sms. Maybe you should check your CiviMail settings as well? (Just a longshot, so take it for what it is worth)
    – Flying
    Apr 10, 2015 at 18:00
  • Just checked: bulk email goes through but not bulk SMS... Apr 10, 2015 at 23:43

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