\n"); $error_message = getLanguageText('ERRORMSG-ACCESS-DENIED'); include "form.messages.php"; return; } // if ($_SESSION['UserInfo']['type'] == 'SuperUser') startLog("email-batch-post.php"); writeLog(print_r($_POST,true)); // // Get the set of records to send emails to // $CurrentDomain = strtolower($_SERVER['HTTP_HOST']); $Query = stripslashes($Query); $results = db_query($Query); if ($results) { $num_rows = db_num_rows($results); // Get the message to send $content = db_query("SELECT * FROM formatted_content WHERE record_num = '$MessageID'"); $row = db_fetch_array($content); $EmailSubject = db_escape_string($row["content_id"]); $EmailMessage = db_escape_string($row["content"]); // Process logged in user's details into email message $ufields = array("first_name","last_name","email","title"); for ($i = 0; $i < count($ufields); $i++) { $fname = $ufields[$i]; if (array_key_exists($fname, $_SESSION['UserInfo'])) $EmailMessage = preg_replace('/({|%7b)users.' . $fname . '(}|%7d)/i',$_SESSION['UserInfo'][$fname],$EmailMessage); } // Process custom fields into email message foreach ($_POST as $fieldname => $fieldvalue) { if (stripos('custom_', $fieldname) !== 0) continue; $field_code = str_replace("custom_","",$fieldname); $fieldvalue = db_escape_string(nl2br($fieldvalue)); $EmailMessage = preg_replace('/({|%7b)custom\.[a-z]+\.' . $field_code . '(}|%7d)/i',$fieldvalue,$EmailMessage); } $Category = db_escape_string($Category); $Description = db_escape_string($Description); $ReplyDescription = db_escape_string($ReplyDescription); $attachments = db_escape_string($attachments); writeLog("attachments: $attachments"); $groupid = 0; if (array_key_exists('group_num',$_SESSION['UserInfo'])) $groupid = $_SESSION['UserInfo']['group_num']; // $sendMode = "Email"; // if ($SendAfter == 'log-only') { // } // Write email_log_config record $SendTime = strtotime($SendAfter); $Query = db_escape_string($Query); $current_user = $_SESSION['UserInfo']['record_num']; $equery = "INSERT INTO email_header " . "(school_num,category, description, reply_address, reply_description, email_message_id, subject, message_text, email_template, " . "posted, send_after, send_after_time, matching_records, processed_records, sent_successfully, skipped, errors, email_field_name, primary_table, " . "query, parameters, status, user_num, attachments) " . "VALUES ($school_num,'$Category', '$Description', '$ReplyTo', '$ReplyDescription', '$MessageID', '$EmailSubject', '$EmailMessage', '$EmailTemplate', " . "now(), '$SendAfter', $SendTime, '$num_rows', 0, 0, 0, 0, '$EmailField', '$PrimaryTable', '$Query', '$Parameters', 'open', $current_user, '$attachments')"; writeLog($equery); db_query($equery); $email_log_id = db_insert_id(); ?>

Send Emails

records found

Email processing will start after:

View Logs



No matching records found