예제 #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;
 }
예제 #2
0
// require once here so that mailer can use
if (!isset($pommo->_session['personalization'])) {
    $pommo->_session['personalization'] = FALSE;
    $matches1 = array();
    $matches2 = array();
    $matches3 = array();
    preg_match('/\\[\\[[^\\]]+]]/', $mailing->_mailing['body'], $matches1);
    preg_match('/\\[\\[[^\\]]+]]/', $mailing->_mailing['altbody'], $matches2);
    preg_match('/\\[\\[[^\\]]+]]/', $mailing->_mailing['subject'], $matches3);
    if (!empty($matches1) || !empty($matches2) || !empty($matches3)) {
        $pommo->_session['personalization'] = TRUE;
    }
    // cache personalizations in session
    if ($pommo->_session['personalization']) {
        $pommo->_session['personalization_body'] = PommoHelperPersonalize::search($mailing->_mailing['body']);
        $pommo->_session['personalization_altbody'] = PommoHelperPersonalize::search($mailing->_mailing['altbody']);
        $pommo->_session['personalization_subject'] = PommoHelperPersonalizeTitle::search($mailing->_mailing['subject']);
    }
}
/**********************************
 * PREPARE THE MAILER
 *********************************/
$html = $mailing->_mailing['ishtml'] == 'on' ? TRUE : FALSE;
$mailer = new PommoMailer($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'])) {
    $mailer->shutdown('*** ERROR *** prepareMail() returned errors.');
}
// Set appropriate SMTP relay
if ($config['list_exchanger'] == 'smtp') {
    $mailer->setRelay(unserialize($config['smtp_1']));
    //$mailer->setRelay($config['smtp_' . $relayID]); /* PR15: depricated */
예제 #3
0
        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