Ejemplo n.º 1
0
 function send($newsletter_id)
 {
     $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
         // Préparation de l'envoie du mail en HTML
         $mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);
         $mimemessage->build_message();
         // ################# END - Contribution Newsletter v050 ##############
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
Ejemplo n.º 2
0
            $subscribers_email_address = tep_db_prepare_input($_POST['subscribers_email_address']);
            $mail_query = tep_db_query("select subscribers_firstname, subscribers_lastname, subscribers_email_address from " . TABLE_SUBSCRIBERS . " where subscribers_email_address = '" . tep_db_input($subscribers_email_address) . "'");
            $mail_sent_to = $_POST['subscribers_email_address'];
            break;
    }
    $from = tep_db_prepare_input($_POST['from']);
    $subject = tep_db_prepare_input($_POST['subject']);
    $message = tep_db_prepare_input($_POST['message']);
    //Let's build a message object using the email class
    $mimemessage = new email(array('X-Mailer: osCommerce'));
    // add the message to the object
    // MaxiDVD Added Line For WYSIWYG HTML Area: BOF (Send TEXT Email when WYSIWYG Disabled)
    if (HTML_AREA_WYSIWYG_DISABLE_EMAIL == 'Disable') {
        $mimemessage->add_text($message);
    } else {
        $mimemessage->add_html_newsletter($message);
    }
    // MaxiDVD Added Line For WYSIWYG HTML Area: EOF (Send HTML Email when WYSIWYG Enabled)
    $mimemessage->build_message();
    while ($mail = tep_db_fetch_array($mail_query)) {
        $mimemessage->send($mail['subscribers_firstname'] . ' ' . $mail['subscribers_lastname'], $mail['subscribers_email_address'], '', $from, $subject);
    }
    tep_redirect(tep_href_link(FILENAME_MAILS, 'mail_sent_to=' . urlencode($mail_sent_to)));
}
if ($_GET['action'] == 'preview' && !$_POST['subscribers_email_address']) {
    $messageStack->add(ERROR_NO_SUBSCRIBER_SELECTED, 'error');
}
if ($_GET['mail_sent_to']) {
    $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice');
}
?>
Ejemplo n.º 3
0
 function send($newsletter_id)
 {
     global $_POST;
     $audience = array();
     if (isset($_POST['global']) && $_POST['global'] == 'true') {
         $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id");
         while ($products = tep_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = tep_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = tep_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     } else {
         $chosen = $_POST['chosen'];
         $ids = implode(',', $chosen);
         $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in (" . $ids . ")");
         while ($products = tep_db_fetch_array($products_query)) {
             $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'], 'lastname' => $products['customers_lastname'], 'email_address' => $products['customers_email_address']);
         }
         $customers_query = tep_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id and ci.global_product_notifications = '1'");
         while ($customers = tep_db_fetch_array($customers_query)) {
             $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
         }
     }
     $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
     // ################# Contribution Newsletter v050 ##############
     $mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . HTTP_SERVER . DIR_WS_CATALOG . " " . $this->unsubscribeb . " " . $customers['customers_email_address']);
     // ################# END - Contribution Newsletter v050 ##############
     $mimemessage->build_message();
     reset($audience);
     while (list($key, $value) = each($audience)) {
         $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }