$contact_id = $q->contact_id;
- $mailing_id = (int) civicrm_api3('MailingJobQueue', 'getvalue', ['id' => $queue_id, 'return' => 'mailing_id']);
+ $mailing_id = (int) civicrm_api3('MailingEventQueue', 'getvalue', ['id' => $queue_id, 'return' => 'mailing_id']);
$mailing_type = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailing_id, 'mailing_type', 'id');
// We need a mailing id that points to the mailing that defined the recipients.
public static function send_unsub_response($queue_id, $groups, $is_domain, $job) {
$config = CRM_Core_Config::singleton();
$domain = CRM_Core_BAO_Domain::getDomain();
- $jobObject = new CRM_Mailing_BAO_MailingJob();
- $jobTable = $jobObject->getTableName();
$mailingObject = new CRM_Mailing_DAO_Mailing();
$mailingTable = $mailingObject->getTableName();
$contactsObject = new CRM_Contact_DAO_Contact();
$dao = new CRM_Mailing_BAO_Mailing();
$dao->query(" SELECT * FROM $mailingTable
- INNER JOIN $jobTable ON
- $jobTable.mailing_id = $mailingTable.id
- WHERE $jobTable.id = $job");
+ INNER JOIN civicrm_mailing_event_queue queue ON
+ queue.mailing_id = $mailingTable.id
+ WHERE queue.id = $queue_id");
$dao->fetch();
$component = new CRM_Mailing_BAO_MailingComponent();