show_choose_audience = false; $this->title = $title; $this->content = $content; } function choose_audience() { return false; } function confirm() { global $HTTP_GET_VARS; $mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mail = tep_db_fetch_array($mail_query); $confirm_string = '' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . '
' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '
' . tep_draw_separator('pixel_trans.gif', '1', '10') . '
' . $this->title . '
' . tep_draw_separator('pixel_trans.gif', '1', '10') . '
' . nl2br($this->content) . '
' . tep_draw_separator('pixel_trans.gif', '1', '10') . '
' . tep_image_button('button_send.gif', IMAGE_SEND) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '
'; return $confirm_string; } function send($newsletter_id) { $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'"); $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer')); $mimemessage->add_text($this->content); $mimemessage->build_message(); while ($mail = tep_db_fetch_array($mail_query)) { $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) . "'"); } } ?>