示例#1
0
 function send($newsletter_id)
 {
     $OSCOM_Db = Registry::get('Db');
     $newsletterEmail = new Mail();
     $newsletterEmail->setFrom(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER);
     $newsletterEmail->setSubject($this->title);
     if (!empty($this->content)) {
         $newsletterEmail->setBodyPlain($this->content);
     }
     if (!empty($this->content_html)) {
         $newsletterEmail->setBodyHTML($this->content_html);
     }
     $Qmail = $OSCOM_Db->get('customers', ['customers_firstname', 'customers_lastname', 'customers_email_address'], ['customers_newsletter' => '1']);
     while ($Qmail->fetch()) {
         $newsletterEmail->clearTo();
         $newsletterEmail->addTo($Qmail->value('customers_email_address'), $Qmail->value('customers_firstname') . ' ' . $Qmail->value('customers_lastname'));
         $newsletterEmail->send();
     }
     $OSCOM_Db->save('newsletters', ['date_sent' => 'now()', 'status' => '1'], ['newsletters_id' => (int) $newsletter_id]);
 }
示例#2
0
    switch ($_POST['customers_email_address']) {
        case '***':
            $Qmail = $OSCOM_Db->get('customers', ['customers_firstname', 'customers_lastname', 'customers_email_address']);
            $mail_sent_to = OSCOM::getDef('text_all_customers');
            break;
        case '**D':
            $Qmail = $OSCOM_Db->get('customers', ['customers_firstname', 'customers_lastname', 'customers_email_address'], ['customers_newsletter' => '1']);
            $mail_sent_to = OSCOM::getDef('text_newsletter_customers');
            break;
        default:
            $customers_email_address = HTML::sanitize($_POST['customers_email_address']);
            $Qmail = $OSCOM_Db->get('customers', ['customers_firstname', 'customers_lastname', 'customers_email_address'], ['customers_email_address' => $customers_email_address]);
            $mail_sent_to = $customers_email_address;
            break;
    }
    $customerEmail = new Mail();
    $customerEmail->setFrom($_POST['from']);
    $customerEmail->setSubject($_POST['subject']);
    if (!empty($_POST['message'])) {
        $customerEmail->setBodyPlain($_POST['message']);
    }
    if (!empty($_POST['message_html'])) {
        $customerEmail->setBodyHTML($_POST['message_html']);
    }
    while ($Qmail->fetch()) {
        $customerEmail->clearTo();
        $customerEmail->addTo($Qmail->value('customers_email_address'), $Qmail->value('customers_firstname') . ' ' . $Qmail->value('customers_lastname'));
        $customerEmail->send();
    }
    OSCOM::redirect(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to));
}
示例#3
0
 function process()
 {
     if (!$this->valid_cfg) {
         return;
     }
     global $order, $insert_id;
     $OSCOM_Db = Registry::get('Db');
     $orderId = $insert_id;
     // just to make it obvious.
     $debug_email = '';
     if ($this->debug) {
         $debug_email .= '------------[New Order ' . $orderId . ']-----------------' . "\n" . '$order =' . "\n" . print_r($order, true) . '$_COOKIE =' . "\n" . print_r($_COOKIE, true);
     }
     if (!isset($_COOKIE['mailchimp_campaign_id']) || !isset($_COOKIE['mailchimp_email_id'])) {
         return;
     }
     if ($this->debug) {
         $debug_email .= date('Y-m-d H:i:s') . ' current ids:' . "\n" . date('Y-m-d H:i:s') . ' eid =' . $_COOKIE['mailchimp_email_id'] . "\n" . date('Y-m-d H:i:s') . ' cid =' . $_COOKIE['mailchimp_campaign_id'] . "\n";
     }
     $Qorder = $OSCOM_Db->get('orders', 'orders_id', ['customers_id' => $_SESSION['customer_id']], 'date_purchased desc', 1);
     $totals_array = array();
     $Qtotals = $OSCOM_Db->get('orders_total', ['value', 'class'], ['orders_id' => $Qorder->valueInt('orders_id')]);
     while ($Qtotals->fetch()) {
         $totals_array[$Qtotals->value('class')] = $Qtotals->value('value');
     }
     $products_array = array();
     $Qproducts = $OSCOM_Db->get('orders_products', ['products_id', 'products_model', 'products_name', 'products_tax', 'products_quantity', 'final_price'], ['orders_id' => $Qorder->valueInt('orders_id')]);
     while ($Qproducts->fetch()) {
         $products_array[] = array('id' => $Qproducts->valueInt('products_id'), 'name' => $Qproducts->value('products_name'), 'model' => $Qproducts->value('products_model'), 'qty' => $Qproducts->value('products_quantity'), 'final_price' => $Qproducts->value('final_price'));
         $totals_array['ot_tax'] += $Qproducts->value('product_tax');
     }
     $mcorder = array('id' => $Qorder->valueInt('orders_id'), 'total' => $totals_array['ot_total'], 'shipping' => $totals_array['ot_shipping'], 'tax' => $totals_array['ot_tax'], 'items' => array(), 'store_id' => $this->store_id, 'store_name' => $_SERVER['SERVER_NAME'], 'campaign_id' => $_COOKIE['mailchimp_campaign_id'], 'email_id' => $_COOKIE['mailchimp_email_id'], 'plugin_id' => 1216);
     foreach ($products_array as $product) {
         $item = array();
         $item['line_num'] = $line;
         $item['product_id'] = $product['id'];
         $item['product_name'] = $product['name'];
         $item['sku'] = $product['model'];
         $item['qty'] = $product['qty'];
         $item['cost'] = $product['final_price'];
         //All this to get a silly category name from here
         $Qcat = $OSCOM_Db->get('products_to_categories', 'categories_id', ['products_id' => $product['id']], null, 1);
         $cat_id = $Qcat->valueInt('categories_id');
         $item['category_id'] = $cat_id;
         $cat_name == '';
         $continue = true;
         while ($continue) {
             //now recurse up the categories tree...
             $Qcat = $OSCOM_Db->prepare('select c.categories_id, c.parent_id, cd.categories_name from :table_categories c inner join :table_categories_description cd on c.categories_id = cd.categories_id where c.categories_id = :categories_id');
             $Qcat->bindInt(':categories_id', $cat_id);
             $Qcat->execute();
             if ($cat_name == '') {
                 $cat_name = $Qcat->value('categories_name');
             } else {
                 $cat_name = $Qcat->value('categories_name') . ' - ' . $cat_name;
             }
             $cat_id = $Qcat->valueInt('parent_id');
             if ($cat_id == 0) {
                 $continue = false;
             }
         }
         $item['category_name'] = $cat_name;
         $mcorder['items'][] = $item;
     }
     $GLOBALS["mc_api_key"] = $this->apikey;
     $api = new MCAPI('notused', 'notused');
     $res = $api->campaignEcommAddOrder($mcorder);
     if ($api->errorMessage != '') {
         if ($this->debug) {
             $debug_email .= 'Error:' . "\n" . $api->errorMessage . "\n";
         }
     } else {
         //nothing
     }
     // send!()
     if ($this->debug && !empty($debug_email)) {
         $debugEmail = new Mail(MODULE_HEADER_TAGS_MAILCHIMP_360_DEBUG_EMAIL, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, 'MailChimp Debug E-Mail');
         $debugEmail->setBody($debug_email);
         $debugEmail->send();
     }
 }
示例#4
0
        $messageStack->add('friend', OSCOM::getDef('error_to_address'));
    }
    $actionRecorder = new actionRecorder('ar_tell_a_friend', isset($_SESSION['customer_id']) ? $_SESSION['customer_id'] : null, $from_name);
    if (!$actionRecorder->canPerform()) {
        $error = true;
        $actionRecorder->record(false);
        $messageStack->add('friend', OSCOM::getDef('error_action_recorder', ['module_action_recorder_tell_a_friend_email_minutes' => defined('MODULE_ACTION_RECORDER_TELL_A_FRIEND_EMAIL_MINUTES') ? (int) MODULE_ACTION_RECORDER_TELL_A_FRIEND_EMAIL_MINUTES : 15]));
    }
    if ($error == false) {
        $email_subject = OSCOM::getDef('text_email_subject', ['from_name' => $from_name, 'store_name' => STORE_NAME]);
        $email_body = OSCOM::getDef('text_email_intro', ['to_name' => $to_name, 'from_name' => $from_name, 'products_name' => $Qproduct->value('products_name'), 'store_name' => STORE_NAME]) . "\n\n";
        if (tep_not_null($message)) {
            $email_body .= $message . "\n\n";
        }
        $email_body .= OSCOM::getDef('text_email_link', ['email_product_link' => OSCOM::link('product_info.php', 'products_id=' . $Qproduct->valueInt('products_id'), false)]) . "\n\n" . OSCOM::getDef('text_email_signature', ['email_store_name_link' => STORE_NAME . "\n" . OSCOM::link('index.php', null, false) . "\n"]);
        $tellfriendEmail = new Mail($to_email_address, $to_name, $from_email_address, $from_name, $email_subject);
        $tellfriendEmail->setBody($email_body);
        $tellfriendEmail->send();
        $actionRecorder->record();
        $messageStack->add_session('header', OSCOM::getDef('text_email_successful_sent', ['email_products_name' => $Qproduct->value('products_name'), 'to_name' => HTML::outputProtected($to_name)]), 'success');
        OSCOM::redirect('product_info.php', 'products_id=' . $Qproduct->valueInt('products_id'));
    }
} elseif (isset($_SESSION['customer_id'])) {
    $Qcustomer = $OSCOM_Db->get('customers', ['customers_firstname', 'customers_lastname', 'customers_email_address'], ['customers_id' => $_SESSION['customer_id']]);
    $from_name = $Qcustomer->value('customers_firstname') . ' ' . $Qcustomer->value('customers_lastname');
    $from_email_address = $Qcustomer->value('customers_email_address');
}
$breadcrumb->add(OSCOM::getDef('navbar_title'), OSCOM::link('tell_a_friend.php', 'products_id=' . $Qproduct->valueInt('products_id')));
require $oscTemplate->getFile('template_top.php');
?>
示例#5
0
 function sendDebugEmail($response = array())
 {
     if (tep_not_null(MODULE_PAYMENT_SAGE_PAY_SERVER_DEBUG_EMAIL)) {
         $email_body = '';
         if (!empty($response)) {
             $email_body .= 'RESPONSE:' . "\n\n" . print_r($response, true) . "\n\n";
         }
         if (!empty($_POST)) {
             $email_body .= '$_POST:' . "\n\n" . print_r($_POST, true) . "\n\n";
         }
         if (!empty($_GET)) {
             $email_body .= '$_GET:' . "\n\n" . print_r($_GET, true) . "\n\n";
         }
         if (!empty($email_body)) {
             $debugEmail = new Mail(MODULE_PAYMENT_SAGE_PAY_SERVER_DEBUG_EMAIL, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, 'Sage Pay Server Debug E-Mail');
             $debugEmail->setBody($email_body);
             $debugEmail->send();
         }
     }
 }
if ($order->content_type != 'virtual') {
    $email_order .= "\n" . OSCOM::getDef('email_text_delivery_address') . "\n" . OSCOM::getDef('email_separator') . "\n" . tep_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
}
$email_order .= "\n" . OSCOM::getDef('email_text_billing_address') . "\n" . OSCOM::getDef('email_separator') . "\n" . tep_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
if (isset($OSCOM_PM)) {
    $email_order .= OSCOM::getDef('email_text_payment_method') . "\n" . OSCOM::getDef('email_separator') . "\n";
    $email_order .= $order->info['payment_method'] . "\n\n";
    if (isset($OSCOM_PM->email_footer)) {
        $email_order .= $OSCOM_PM->email_footer . "\n\n";
    }
}
$orderEmail = new Mail($order->customer['email_address'], $order->customer['firstname'] . ' ' . $order->customer['lastname'], STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_text_subject'));
$orderEmail->setBody($email_order);
$orderEmail->send();
// send emails to other people
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    $extraEmail = new Mail(SEND_EXTRA_ORDER_EMAILS_TO, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_text_subject'));
    $extraEmail->setBody($email_order);
    $extraEmail->send();
}
// load the after_process function from the payment modules
$payment_modules->after_process();
$_SESSION['cart']->reset(true);
// unregister session variables used during checkout
unset($_SESSION['sendto']);
unset($_SESSION['billto']);
unset($_SESSION['shipping']);
unset($_SESSION['payment']);
unset($_SESSION['comments']);
OSCOM::redirect('checkout_success.php');
require 'includes/application_bottom.php';
示例#7
0
    $error = false;
    $name = HTML::sanitize($_POST['name']);
    $email_address = HTML::sanitize($_POST['email']);
    $enquiry = HTML::sanitize($_POST['enquiry']);
    if (!Is::email($email_address)) {
        $error = true;
        $messageStack->add('contact', OSCOM::getDef('entry_email_address_check_error'));
    }
    $actionRecorder = new actionRecorder('ar_contact_us', isset($_SESSION['customer_id']) ? $_SESSION['customer_id'] : null, $name);
    if (!$actionRecorder->canPerform()) {
        $error = true;
        $actionRecorder->record(false);
        $messageStack->add('contact', OSCOM::getDef('error_action_recorder', ['module_action_recorder_contact_us_email_minutes' => defined('MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES') ? (int) MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES : 15]));
    }
    if ($error == false) {
        $contactEmail = new Mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $email_address, $name, OSCOM::getDef('email_subject', ['store_name' => STORE_NAME]));
        $contactEmail->setBody($enquiry);
        $contactEmail->send();
        $actionRecorder->record();
        OSCOM::redirect('contact_us.php', 'action=success');
    }
}
$breadcrumb->add(OSCOM::getDef('navbar_title'), OSCOM::link('contact_us.php'));
require $oscTemplate->getFile('template_top.php');
?>

<div class="page-header">
  <h1><?php 
echo OSCOM::getDef('heading_title');
?>
</h1>
示例#8
0
 $order_updated = false;
 $Qcheck = $OSCOM_Db->get('orders', ['customers_name', 'customers_email_address', 'orders_status', 'date_purchased'], ['orders_id' => (int) $oID]);
 if ($Qcheck->value('orders_status') != $status || tep_not_null($comments)) {
     $OSCOM_Db->save('orders', ['orders_status' => $status, 'last_modified' => 'now()'], ['orders_id' => (int) $oID]);
     $customer_notified = '0';
     if (isset($_POST['notify']) && $_POST['notify'] == 'on') {
         $notify_comments = '';
         $notify_comments_html = '';
         if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') {
             $notify_comments = OSCOM::getDef('email_text_comments_update', ['comments' => $comments]) . "\n\n";
             $notify_comments_html = OSCOM::getDef('email_text_comments_update_html', ['comments' => nl2br($comments)]);
         }
         $invoice_url = OSCOM::link('Shop/' . FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID);
         $email = STORE_NAME . "\n" . OSCOM::getDef('email_separator') . "\n" . OSCOM::getDef('email_text_order_number') . ' ' . $oID . "\n" . OSCOM::getDef('email_text_invoice_url') . ' ' . $invoice_url . "\n" . OSCOM::getDef('email_text_date_ordered') . ' ' . DateTime::toLong($Qcheck->value('date_purchased')) . "\n\n" . $notify_comments . OSCOM::getDef('email_text_status_update', ['status' => $orders_status_array[$status]]) . "\n";
         $email_html = '<p>' . STORE_NAME . '</p>' . OSCOM::getDef('email_separator_html') . '<p>' . OSCOM::getDef('email_text_order_number_html') . ' ' . $oID . '</p><p>' . OSCOM::getDef('email_text_invoice_url_html') . ' <a href="' . $invoice_url . '">' . $invoice_url . '</a></p><p>' . OSCOM::getDef('email_text_date_ordered_html') . ' ' . DateTime::toLong($Qcheck->value('date_purchased')) . '</p>' . $notify_comments_html . OSCOM::getDef('email_text_status_update_html', ['status' => $orders_status_array[$status]]);
         $orderEmail = new Mail($Qcheck->value('customers_email_address'), $Qcheck->value('customers_name'), STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_text_subject'));
         $orderEmail->setBodyPlain($email);
         $orderEmail->setBodyHTML($email_html);
         $orderEmail->send();
         $customer_notified = '1';
     }
     $OSCOM_Db->save('orders_status_history', ['orders_id' => (int) $oID, 'orders_status_id' => $status, 'date_added' => 'now()', 'customer_notified' => $customer_notified, 'comments' => $comments]);
     $order_updated = true;
 }
 if ($order_updated == true) {
     $OSCOM_MessageStack->add(OSCOM::getDef('success_order_updated'), 'success');
 } else {
     $OSCOM_MessageStack->add(OSCOM::getDef('warning_order_not_updated'), 'warning');
 }
 OSCOM::redirect(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit');
 break;
$OSCOM_Language->loadDefinitions('password_forgotten');
$password_reset_initiated = false;
if (isset($_GET['action']) && $_GET['action'] == 'process' && isset($_POST['formid']) && $_POST['formid'] == $_SESSION['sessiontoken']) {
    $email_address = HTML::sanitize($_POST['email_address']);
    $Qcheck = $OSCOM_Db->get('customers', ['customers_firstname', 'customers_lastname', 'customers_id'], ['customers_email_address' => $email_address]);
    if ($Qcheck->fetch() !== false) {
        $actionRecorder = new actionRecorder('ar_reset_password', $Qcheck->valueInt('customers_id'), $email_address);
        if ($actionRecorder->canPerform()) {
            $actionRecorder->record();
            $reset_key = Hash::getRandomString(40);
            $OSCOM_Db->save('customers_info', ['password_reset_key' => $reset_key, 'password_reset_date' => 'now()'], ['customers_info_id' => $Qcheck->valueInt('customers_id')]);
            $reset_key_url = OSCOM::link('password_reset.php', 'account=' . urlencode($email_address) . '&key=' . $reset_key, false);
            if (strpos($reset_key_url, '&amp;') !== false) {
                $reset_key_url = str_replace('&amp;', '&', $reset_key_url);
            }
            $passwordEmail = new Mail($email_address, $Qcheck->value('customers_firstname') . ' ' . $Qcheck->value('customers_lastname'), STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_password_reset_subject', ['store_name' => STORE_NAME]));
            $passwordEmail->setBodyHTML(OSCOM::getDef('email_password_reset_body_html', ['store_name' => STORE_NAME, 'store_email_address' => STORE_OWNER_EMAIL_ADDRESS, 'reset_url' => $reset_key_url]));
            $passwordEmail->setBodyPlain(OSCOM::getDef('email_password_reset_body', ['store_name' => STORE_NAME, 'store_email_address' => STORE_OWNER_EMAIL_ADDRESS, 'reset_url' => $reset_key_url]));
            $passwordEmail->send();
            $password_reset_initiated = true;
        } else {
            $actionRecorder->record(false);
            $messageStack->add('password_forgotten', OSCOM::getDef('error_action_recorder', ['module_action_recorder_reset_password_minutes' => defined('MODULE_ACTION_RECORDER_RESET_PASSWORD_MINUTES') ? (int) MODULE_ACTION_RECORDER_RESET_PASSWORD_MINUTES : 5]));
        }
    } else {
        $messageStack->add('password_forgotten', OSCOM::getDef('text_no_email_address_found'));
    }
}
$breadcrumb->add(OSCOM::getDef('navbar_title_1'), OSCOM::link('login.php'));
$breadcrumb->add(OSCOM::getDef('navbar_title_2'), OSCOM::link('password_forgotten.php'));
require $oscTemplate->getFile('template_top.php');
示例#10
0
        $name = $firstname . ' ' . $lastname;
        if (ACCOUNT_GENDER == 'true') {
            if ($gender == 'm') {
                $email_text = OSCOM::getDef('email_greet_mr', ['lastname' => $lastname]);
                $email_text_html = OSCOM::getDef('email_greet_mr_html', ['lastname' => $lastname]);
            } else {
                $email_text = OSCOM::getDef('email_greet_ms', ['lastname' => $lastname]);
                $email_text_html = OSCOM::getDef('email_greet_ms_html', ['lastname' => $lastname]);
            }
        } else {
            $email_text = OSCOM::getDef('email_greet_none', ['firstname' => $firstname]);
            $email_text_html = OSCOM::getDef('email_greet_none_html', ['firstname' => $firstname]);
        }
        $email_text .= "\n\n" . OSCOM::getDef('email_welcome', ['store_name' => STORE_NAME]) . "\n\n" . OSCOM::getDef('email_text') . "\n\n" . OSCOM::getDef('email_contact', ['store_email_address' => STORE_OWNER_EMAIL_ADDRESS]) . "\n\n" . OSCOM::getDef('email_warning', ['store_email_address' => STORE_OWNER_EMAIL_ADDRESS]) . "\n";
        $email_text_html .= OSCOM::getDef('email_welcome_html', ['store_name' => STORE_NAME]) . OSCOM::getDef('email_text_html') . OSCOM::getDef('email_contact_html', ['store_email_address' => STORE_OWNER_EMAIL_ADDRESS]) . OSCOM::getDef('email_warning_html', ['store_email_address' => STORE_OWNER_EMAIL_ADDRESS]);
        $customerEmail = new Mail($email_address, $name, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_subject', ['store_name' => STORE_NAME]));
        $customerEmail->setBodyPlain($email_text);
        $customerEmail->setBodyHTML($email_text_html);
        $customerEmail->send();
        OSCOM::redirect('create_account_success.php');
    }
}
$breadcrumb->add(OSCOM::getDef('navbar_title'), OSCOM::link('create_account.php'));
require $oscTemplate->getFile('template_top.php');
?>

<div class="page-header">
  <h1><?php 
echo OSCOM::getDef('heading_title');
?>
</h1>
 function send($newsletter_id)
 {
     $OSCOM_Db = Registry::get('Db');
     $audience = array();
     if (isset($_POST['global']) && $_POST['global'] == 'true') {
         $Qproducts = $OSCOM_Db->get(['customers c', 'products_notifications pn'], ['distinct pn.customers_id', 'c.customers_firstname', 'c.customers_lastname', 'c.customers_email_address'], ['c.customers_id' => ['rel' => 'pn.customers_id']]);
         while ($Qproducts->fetch()) {
             $audience[$Qproducts->valueInt('customers_id')] = ['firstname' => $Qproducts->value('customers_firstname'), 'lastname' => $Qproducts->value('customers_lastname'), 'email_address' => $Qproducts->value('customers_email_address')];
         }
         $Qcustomers = $OSCOM_Db->get(['customers c', 'customers_info ci'], ['c.customers_id', 'c.customers_firstname', 'c.customers_lastname', 'c.customers_email_address'], ['c.customers_id' => ['rel' => 'ci.customers_info_id'], 'ci.global_product_notifications' => '1']);
         while ($Qcustomers->fetch()) {
             $audience[$Qcustomers->valueInt('customers_id')] = ['firstname' => $Qcustomers->value('customers_firstname'), 'lastname' => $Qcustomers->value('customers_lastname'), 'email_address' => $Qcustomers->value('customers_email_address')];
         }
     } else {
         $chosen = [];
         foreach ($_POST['chosen'] as $id) {
             if (is_numeric($id) && !in_array($id, $chosen)) {
                 $chosen[] = $id;
             }
         }
         $ids = array_map(function ($k) {
             return ':products_id_' . $k;
         }, array_keys($chosen));
         $Qproducts = $OSCOM_Db->prepare('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 (' . implode(', ', $ids) . ')');
         foreach ($chosen as $k => $v) {
             $Qproducts->bindInt(':products_id_' . $k, $v);
         }
         $Qproducts->execute();
         while ($Qproducts->fetch()) {
             $audience[$Qproducts->valueInt('customers_id')] = ['firstname' => $Qproducts->value('customers_firstname'), 'lastname' => $Qproducts->value('customers_lastname'), 'email_address' => $Qproducts->value('customers_email_address')];
         }
         $Qcustomers = $OSCOM_Db->get(['customers c', 'customers_info ci'], ['c.customers_id', 'c.customers_firstname', 'c.customers_lastname', 'c.customers_email_address'], ['c.customers_id' => ['rel' => 'ci.customers_info_id'], 'ci.global_product_notifications' => '1']);
         while ($Qcustomers->fetch()) {
             $audience[$Qcustomers->valueInt('customers_id')] = ['firstname' => $Qcustomers->value('customers_firstname'), 'lastname' => $Qcustomers->value('customers_lastname'), 'email_address' => $Qcustomers->value('customers_email_address')];
         }
     }
     $notificationEmail = new Mail();
     $notificationEmail->setFrom(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER);
     $notificationEmail->setSubject($this->title);
     if (!empty($this->content)) {
         $notificationEmail->setBodyPlain($this->content);
     }
     if (!empty($this->content_html)) {
         $notificationEmail->setBodyHTML($this->content_html);
     }
     foreach ($audience as $key => $value) {
         $notificationEmail->clearTo();
         $notificationEmail->addTo($value['email_address'], $value['firstname'] . ' ' . $value['lastname']);
         $notificationEmail->send();
     }
     $OSCOM_Db->save('newsletters', ['date_sent' => 'now()', 'status' => '1'], ['newsletters_id' => (int) $newsletter_id]);
 }
示例#12
0
 function sendDebugEmail($response = array())
 {
     if (tep_not_null(MODULE_PAYMENT_SAGE_PAY_DIRECT_DEBUG_EMAIL)) {
         $email_body = '';
         if (!empty($response)) {
             $email_body .= 'RESPONSE:' . "\n\n" . print_r($response, true) . "\n\n";
         }
         if (!empty($_POST)) {
             if (isset($_POST['cc_number_nh-dns'])) {
                 $_POST['cc_number_nh-dns'] = 'XXXX' . substr($_POST['cc_number_nh-dns'], -4);
             }
             if (isset($_POST['cc_cvc_tokens_nh-dns'])) {
                 $_POST['cc_cvc_tokens_nh-dns'] = 'XXX';
             }
             if (isset($_POST['cc_cvc_nh-dns'])) {
                 $_POST['cc_cvc_nh-dns'] = 'XXX';
             }
             if (isset($_POST['cc_issue_nh-dns'])) {
                 $_POST['cc_issue_nh-dns'] = 'XXX';
             }
             if (isset($_POST['cc_expires_month'])) {
                 $_POST['cc_expires_month'] = 'XX';
             }
             if (isset($_POST['cc_expires_year'])) {
                 $_POST['cc_expires_year'] = 'XX';
             }
             if (isset($_POST['cc_starts_month'])) {
                 $_POST['cc_starts_month'] = 'XX';
             }
             if (isset($_POST['cc_starts_year'])) {
                 $_POST['cc_starts_year'] = 'XX';
             }
             $email_body .= '$_POST:' . "\n\n" . print_r($_POST, true) . "\n\n";
         }
         if (!empty($_GET)) {
             $email_body .= '$_GET:' . "\n\n" . print_r($_GET, true) . "\n\n";
         }
         if (!empty($email_body)) {
             $debugEmail = new Mail(MODULE_PAYMENT_SAGE_PAY_DIRECT_DEBUG_EMAIL, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, 'Sage Pay Direct Debug E-Mail');
             $debugEmail->setBody($email_body);
             $debugEmail->send();
         }
     }
 }