Наследование: extends PHPMailer
Пример #1
0
    }
    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;
}
// necessary? (better method!)
$mailing->attach('_mailer', $mailer);
/**********************************
 * INITIALIZE Throttler
 *********************************/
$tid = 1;
// forced shared throttler, until swiftmailer implementation
Пример #2
0
 function notify(&$notices, &$sub, $type, $comments = false)
 {
     global $pommo;
     require_once Pommo::$_baseDir . 'classes/Pommo_Mailer.php';
     $mails = Pommo_Helper::trimArray(explode(',', $notices['email']));
     if (empty($mails[0])) {
         $mails = array(Pommo::$_config['admin_email']);
     }
     $subject = $notices['subject'] . ' ';
     $body = sprintf(Pommo::_T('poMMo %s Notice'), $type);
     $body .= "  [" . date("F j, Y, g:i a") . "]\n\n";
     $body .= "EMAIL: " . $sub['email'] . "\n";
     $body .= "IP: " . $sub['ip'] . "\n";
     $body .= "REGISTERED: " . $sub['registered'] . "\n\n";
     if ($comments) {
         $body .= "COMMENTS: {$comments} \n\n";
     }
     $body .= "DATA:\n";
     require_once Pommo::$_baseDir . 'classes/Pommo_Fields.php';
     $fields = Pommo_Fields::getNames();
     foreach ($sub['data'] as $fid => $v) {
         $body .= "\t" . $fields[$fid] . ": {$v}\n";
     }
     switch ($type) {
         case 'subscribe':
             $subject .= Pommo::_T('new subscriber!');
             break;
         case 'unsubscribe':
             $subject .= Pommo::_T('user unsubscribed.');
             break;
         case 'pending':
             $subject .= Pommo::_T('new pending!');
             break;
         case 'update':
             $subject .= Pommo::_T('subscriber updated.');
             break;
     }
     $mail = new Pommo_Mailer();
     // allow mail to be sent, even if demo mode is on
     $mail->toggleDemoMode("off");
     // send the confirmation mail
     $mail->prepareMail($subject, $body);
     foreach ($mails as $to) {
         $mail->bmSendmail($to);
     }
     // reset demo mode to default
     $mail->toggleDemoMode();
     return;
 }