/** * Add given data to the campaign * * @param (array)$data_campaign : the campaign datas * @param (array)$data : the emails to do * @param (string)$content_html : the html content to use * @param (string)$content_text : (optional) the raw content to use on this emailing * * @return boolean * * @author Nicolas Juen * */ public static function registerCampaign($data_campaign, $data, $content_html, $content_text = '', $attachments = array()) { $campaign = new Bea_Sender_Campaign(); $insert = $campaign->add($data_campaign, $data, $content_html, $content_text, $attachments); return $insert; }
$content_html = '<div>HTML Not multiple Okokokokokok</div>'; $content_text = '<div>TEXT Not multiple Okokokokokok</div>'; $campaign = new Bea_Sender_Campaign(); $insert = $campaign->add($data_campaign, $data, $content_html, $content_text); if (!empty($insert)) { print_r($insert); } else { echo $campaign->getID() . ' : ok Single content' . "\n"; } $data_campaign = array('from' => '*****@*****.**', 'from_name' => 'Nicolas Juen', 'subject' => 'Tests mutltiple'); $content_html = '<div>HTML Multiple</div>'; $content_text = '<div>TEXT multiple</div>'; $data = array(array('email' => '*****@*****.**', 'html' => '1' . $content_html, 'text' => '1' . $content_text), array('email' => '*****@*****.**', 'html' => '2' . $content_html, 'text' => '2' . $content_text), array('email' => '*****@*****.**', 'html' => '3' . $content_html, 'text' => '3' . $content_text), array('email' => '*****@*****.**', 'html' => '4' . $content_html, 'text' => '4' . $content_text), array('email' => '*****@*****.**', 'html' => '5' . $content_html, 'text' => '5' . $content_text), array('email' => '*****@*****.**', 'html' => '6' . $content_html, 'text' => '6' . $content_text)); $campaign = new Bea_Sender_Campaign(); $insert = $campaign->add($data_campaign, $data); if (!empty($insert)) { print_r($insert); } else { echo $campaign->getID() . ' : ok Multiple content' . "\n"; } $data_campaign = array('from' => '*****@*****.**', 'from_name' => 'Nicolas Juen', 'subject' => 'Tests mutltiple', 'scheduled_from' => date('Y-m-d H:m:i', strtotime('+15 minutes'))); $content_html = '<div>HTML Multiple</div>'; $content_text = '<div>TEXT multiple</div>'; $data = array(array('email' => '*****@*****.**', 'html' => '1' . $content_html, 'text' => '1' . $content_text), array('email' => '*****@*****.**', 'html' => '2' . $content_html, 'text' => '2' . $content_text), array('email' => '*****@*****.**', 'html' => '3' . $content_html, 'text' => '3' . $content_text), array('email' => '*****@*****.**', 'html' => '4' . $content_html, 'text' => '4' . $content_text), array('email' => '*****@*****.**', 'html' => '5' . $content_html, 'text' => '5' . $content_text), array('email' => '*****@*****.**', 'html' => '6' . $content_html, 'text' => '6' . $content_text)); $campaign = new Bea_Sender_Campaign(); $insert = $campaign->add($data_campaign, $data); if (!empty($insert)) { print_r($insert); } else { echo $campaign->getID() . ' : ok Multiple content' . "\n"; }