require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Personalize.php'; if (!isset(Pommo::$_session['personalization'])) { Pommo::$_session['personalization'] = FALSE; $matches = array(); preg_match('/\\[\\[[^\\]]+]]/', $mailing->_mailing['body'], $matches); if (!empty($matches)) { Pommo::$_session['personalization'] = TRUE; } preg_match('/\\[\\[[^\\]]+]]/', $mailing->_mailing['altbody'], $matches); if (!empty($matches)) { Pommo::$_session['personalization'] = TRUE; } // cache personalizations in session if (Pommo::$_session['personalization']) { Pommo::$_session['personalization_body'] = Pommo_Helper_Personalize::search($mailing->_mailing['body']); Pommo::$_session['personalization_altbody'] = Pommo_Helper_Personalize::search($mailing->_mailing['altbody']); } } /********************************** * PREPARE THE MAILER *********************************/ $html = $mailing->_mailing['ishtml'] == 'on' ? TRUE : FALSE; $mailer = new Pommo_Mailer($mailing->_mailing['fromname'], $mailing->_mailing['fromemail'], $mailing->_mailing['frombounce'], $config['list_exchanger'], NULL, $mailing->_mailing['charset'], Pommo::$_session['personalization']); if (!$mailer->prepareMail($mailing->_mailing['subject'], $mailing->_mailing['body'], $html, $mailing->_mailing['altbody'], $mailing->_mailing['attachments'])) { $mailer->shutdown('*** ERROR *** prepareMail() returned errors.'); } // Set appropriate SMTP relay if ($config['list_exchanger'] == 'smtp') { $mailer->setRelay(unserialize($config['smtp_1'])); $mailer->SMTPKeepAlive = TRUE; }
function bmSendmail(&$to, $subscriber = FALSE) { if ($this->_validated == FALSE) { $this->logger->addMsg("poMMo has not passed sanity checks. has\n prepareMail been called?"); return false; } elseif (empty($to)) { $this->logger->addMsg("To email supplied to send() command is empty."); return false; } $errors = array(); // If poMMo is not in set in demonstration mode, SEND MAILS... if ($this->_demonstration == "off") { // if $to is not an array (single email address has been supplied), simply send the mail. if (!is_array($to)) { $this->AddAddress($to); // check for personalization personaliztion and override message body if ($this->_personalize) { $this->Body = Pommo_Helper_Personalize::replace($this->_body, $subscriber, Pommo::$_session['personalization_body']); if (!empty($this->_altbody)) { $this->AltBody = Pommo_Helper_Personalize::replace($this->_altbody, $subscriber, Pommo::$_session['personalization_altbody']); } } if ($this->_attachments) { $attachments = split(',', $this->_attachments); foreach ($attachments as $key => $attach) { $this->AddAttachment('../attachments/' . $attach); } } // send the mail. If unsucessful, add error message. if (!$this->Send()) { $errors[] = Pommo::_T("Sending failed: ") . $this->ErrorInfo; } $this->ClearAddresses(); } else { // MULTI MODE! -- antiquated. // incorporate BCC+Enveloping in here if type is SMTP // TODO Play w/ the size limiting of arrays sent here } } else { $this->logger->addMsg(sprintf(Pommo::_T("Mail to: %s not sent. Demonstration mode is active."), is_array($to) ? implode(',', $to) : $to)); return true; } // if message(s) exist, return false. (Sending failed w/ error messages) if (!empty($errors)) { $this->logger->addMsg($errors); return false; } return true; }
// attempt personalizations if (isset($_GET['email']) && isset($_GET['code'])) { $subscriber = current(Pommo_Subscribers::get(array('email' => $_GET['email'], 'status' => 1))); if ($_GET['code'] == Pommo_Subscribers::getActCode($subscriber)) { require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Personalize.php'; // require once here so that mailer can use $matches = array(); preg_match('/\\[\\[[^\\]]+]]/', $input['body'], $matches); if (!empty($matches)) { $pBody = Pommo_Helper_Personalize::search($input['body']); $input['body'] = Pommo_Helper_Personalize::replace($input['body'], $subscriber, $pBody); } preg_match('/\\[\\[[^\\]]+]]/', $input['altbody'], $matches); if (!empty($matches)) { $pAltBody = Pommo_Helper_Personalize::search($input['altbody']); $input['altbody'] = Pommo_Helper_Personalize::replace($input['altbody'], $subscriber, $pAltBody); } } } $view->assign($input); $view->display('inc/mailing'); Pommo::kill(); } /********************************** VALIDATION ROUTINES *********************************/ if (!is_numeric($state['limit']) || $state['limit'] < 10 || $state['limit'] > 200) { $state['limit'] = 100; } if ($state['order'] != 'asc' && $state['order'] != 'desc') { $state['order'] = 'asc';