function send($newsletter_id) { global $db; $audience_select = get_audience_sql_query_with_language($this->query_name, 'newsletters'); $audience = $db->Execute($audience_select['query_string']); $records = $audience->RecordCount(); if ($records == 0) { return 0; } $i = 0; while (!$audience->EOF) { $i++; $html_msg['EMAIL_FIRST_NAME'] = $audience->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $audience->fields['customers_lastname']; $html_msg['EMAIL_GREET'] = EMAIL_GREET; $html_msg['EMAIL_MESSAGE_HTML'] = $this->content_html; zen_mail($audience->fields['customers_firstname'] . ' ' . $audience->fields['customers_lastname'], $audience->fields['customers_email_address'], $this->title, $this->content, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletters'); echo zen_image(DIR_WS_ICONS . 'tick.gif', $audience->fields['customers_email_address']); //force output to the screen to show status indicator each time a message is sent... if (function_exists('ob_flush')) { @ob_flush(); } @flush(); $audience->MoveNext(); } $newsletter_id = zen_db_prepare_input($newsletter_id); $db->Execute("update " . TABLE_NEWSLETTERS . "\r\n set date_sent = now(), status = '1'\r\n where newsletters_id = '" . zen_db_input($newsletter_id) . "'"); return $records; //return number of records processed whether successful or not }
</td> <td class="main"> <?php // toggle switch for editor $editor_array = array(array('id' => '0', 'text' => TEXT_NONE), array('id' => '1', 'text' => TEXT_HTML_AREA)); echo TEXT_EDITOR_INFO . zen_draw_form('set_editor_form', FILENAME_MAIL, '', 'get') . ' ' . zen_draw_pull_down_menu('reset_editor', $editor_array, $_SESSION['html_editor_preference_status'] == 'HTMLAREA' ? '1' : '0', 'onChange="this.form.submit();"') . zen_hide_session_id() . zen_draw_hidden_field('action', 'set_editor') . '</form>'; ?> </td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <?php if ($action == 'preview' && isset($_POST['customers_email_address'])) { $audience_select = get_audience_sql_query_with_language($_POST['customers_email_address']); $mail_sent_to = $audience_select['query_name']; $customers_languages_id = $audience_select['customers_languages_id']; ?> <tr> <td><table border="0" width="100%" cellpadding="0" cellspacing="2"> <tr> <td class="smallText"><b><?php echo TEXT_CUSTOMER; ?> </b> <?php echo $mail_sent_to; ?> </td> </tr> <tr>