Hi I'm having this exact problem and have done some debugging:
When making a new SMS there'sthere are three steps
- you first select recipients
- then you write the body of the SMS
- 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 because it has a 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