Exemple #1
0
 function bmSendmail(&$to, $subscriber = FALSE)
 {
     // TODO rename function send in order to not confuse w/ PHPMailer's Send()?
     if ($this->_validated == FALSE) {
         $this->logger->addMsg("poMMo has not passed sanity checks. has prepareMail been called?");
         return false;
     } elseif (empty($to)) {
         $this->logger->addMsg("To email supplied to send() command is empty.");
         return false;
     }
     $errors = array();
     if ($this->_demonstration == "off") {
         // If poMMo is not in set in demonstration mode, SEND MAILS...
         // 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) {
                 global $pommo;
                 $this->Body = PommoHelperPersonalize::replace($this->_body, $subscriber, $pommo->_session['personalization_body']);
                 if (!empty($this->_altbody)) {
                     $this->AltBody = PommoHelperPersonalize::replace($this->_altbody, $subscriber, $pommo->_session['personalization_altbody']);
                 }
             }
             // 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;
 }
        if ($_GET['code'] == PommoSubscriber::getActCode($subscriber)) {
            Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/personalize.php');
            // require once here so that mailer can use
            Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/personalizetitle.php');
            // title personalization
            $matches1 = array();
            preg_match('/\\[\\[[^\\]]+]]/', $input['body'], $matches1);
            if (!empty($matches1)) {
                $pBody = PommoHelperPersonalize::search($input['body']);
                $input['body'] = PommoHelperPersonalize::replace($input['body'], $subscriber, $pBody);
            }
            $matches2 = array();
            preg_match('/\\[\\[[^\\]]+]]/', $input['altbody'], $matches2);
            if (!empty($matches2)) {
                $pAltBody = PommoHelperPersonalize::search($input['altbody']);
                $input['altbody'] = PommoHelperPersonalize::replace($input['altbody'], $subscriber, $pAltBody);
            }
            $matches3 = array();
            preg_match('/\\[\\[[^\\]]+]]/', $input['subject'], $matches3);
            if (!empty($matches3)) {
                $pSubject = PommoHelperPersonalizeTitle::search($input['subject']);
                $input['subject'] = PommoHelperPersonalizeTitle::replace($input['subject'], $subscriber, $pSubject);
            }
        }
        $smarty->assign($input);
        $smarty->display('inc/mailing.tpl');
        Pommo::kill();
    }
}
/**********************************
	VALIDATION ROUTINES