} if (!empty($uroom)) { $text .= "Room: " . $uroom . "\r\n"; } if (!empty($m_subject)) { $text .= "Title: " . $m_subject . "\r\n"; } $text .= "---------------------------------------------------------------------------------------------\r\n"; $text .= "Body: " . $m_body . "\r\n"; $text .= "---------------------------------------------------------------------------------------------\r\n"; $text .= "To edit the ticket: " . KARNAF_URL . "/edit.php?id=" . $tid . "\r\n"; $newsubject = "[" . strtoupper($rep_g) . "] New Ticket #" . $tid; if (!empty($m_subject)) { $newsubject .= " - " . $m_subject; } karnaf_email($result2['autoforward'], $newsubject, $text); } } sql_free_result($query2); } if (defined("KARNAF_DEBUG") && KARNAF_DEBUG == 1 && !empty($debug_body)) { # Note to self: Yes, tid can be 0 here... squery("INSERT INTO karnaf_debug(tid,body) VALUES(%d,'%s')", $tid, $debug_body); } if ($tid && isset($attachments) && count($attachments) > 0) { /* We have attachment(s), let's add them to the ticket... */ foreach ($attachments as $attachment) { if (!isset($attachment['filename'])) { continue; } /* Skip empty attachments */
<?php ################################################################## # Karnaf HelpDesk System - Copyright (C) 2001-2015 Kobi Shmueli. # # See the LICENSE file for more information. # ################################################################## /* This is a script to send all the emails on the queue */ $override_magicquotes = 1; require "../ktools.php"; function karnaf_email($mail_to, $mail_subject, $mail_body) { /* Was only used for debugging: $mail_to = "*****@*****.**"; */ mail($mail_to, $mail_subject, $mail_body, "From: " . MY_EMAIL . "\r\n" . "Reply-To: " . MY_EMAIL); } $query = squery("SELECT id,mail_to,mail_from,mail_subject,mail_body FROM mail_queue ORDER BY id"); while ($result = sql_fetch_array($query)) { echo "Sending #" . $result['id'] . " to " . $result['mail_to'] . "...\n"; karnaf_email($result['mail_to'], $result['mail_subject'], $result['mail_body']); squery("DELETE FROM mail_queue WHERE id=%d", $result['id']); } sql_free_result($query); echo "Done.\n"; require_once "../contentpage_ftr.php";