0) { // Members are available so we can send out the newsletter! while (list($id, $email) = SQL_FETCHROW($result)) { // Construct mail... $template = "newsletter"; // Check for extension and sending-mode if (!EXT_IS_ACTIVE("html_mail", true) && ($_POST['mode'] == "html")) { // Set mode to text mode $_POST['mode'] == "text"; } elseif ($_POST['mode'] == "html") { // Set HTML templates $template = "newsletter_html"; } // Compile message $_POST['text'] = COMPILE_CODE($_POST['text']); // Load template $msg = LOAD_EMAIL_TEMPLATE($template, $_POST['text'], $id); // ... and send it away! SEND_NEWSLETTER($email, $_POST['subject'], $msg, $_POST['mode']); } // Free memory SQL_FREERESULT($result); // Output message LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NL_SEND_DONE); } } else { // Copy data into constants for the template and load it define('_DATESTAMP', MAKE_DATETIME(time(), "3")); if (EXT_IS_ACTIVE("html_mail")) { // Load template with HTML mode LOAD_TEMPLATE("admin_newsletter"); } else { // Load template with only text mode LOAD_TEMPLATE("admin_newsletter_nohtml"); } } // ?>