/** * @return array * @author Nicolas Juen */ private function sendCampaigns() { $results = array(); do_action('bea_sender_before_send'); foreach ($this->campaigns as $campaign_id) { $campaign = new Bea_Sender_Campaign($campaign_id); if ($campaign->isData() !== true) { continue; } $this->log->log_this(sprintf('Send %s campaign', $campaign_id)); do_action('bea_sender_before_send_campaign', $campaign_id, $campaign); // Make the sending $results[] = $campaign->makeSend(); do_action('bea_sender_after_send_campaign', $campaign_id, $campaign); } do_action('bea_sender_after_send'); // Unlock the file self::unlock(); $this->log->log_this('End campaigns ' . var_export($results, true)); return $results; }
public function callback_action($msgnum, $bounce_type, $email, $subject, $xheader, $remove, $rule_no = false, $rule_cat = false, $totalFetched = 0) { /* @var $wpdb wpdb */ global $wpdb; // Callback action $this->log->log_this(sprintf('Callback action on message for %s', $email)); $this->log->log_this(sprintf('Email : %s | bounce_cat : %s | bounce_type : %s | bounce_no : %s', $email, $rule_cat, $bounce_type, $rule_no)); // The query for update bea_s_receivers table $receiver_result = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->bea_s_receivers} WHERE email = %s", $email)); // Update the receiver if possible if ($receiver_result) { $this->log->log_this(sprintf('%s found on database', $email)); $wpdb->update($wpdb->bea_s_receivers, array('current_status' => 'invalid', 'bounce_cat' => $rule_cat, 'bounce_type' => $bounce_type, 'bounce_no' => $rule_no), array('email' => $email), array('%s', '%s', '%s', '%s'), array('%s')); } // The query for update bea_s_re_ca table $receiver_id = Bea_Sender_Receiver::getReceiver($email); $re_ca__result = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->bea_s_re_ca} WHERE id_campaign = %s AND id_receiver = %s", $xheader, $receiver_id)); if ($re_ca__result) { $this->log->log_this(sprintf('%s found on the _re_ca table', $email)); $wpdb->update($wpdb->bea_s_re_ca, array('current_status' => 'bounced'), array('id_campaign' => $xheader, 'id_receiver' => $receiver_id), array('%s'), array('%d', '%d')); } return true; }