diff --git a/cron_mail_queue.php b/cron_mail_queue.php
index f97d17127..c2ce719a2 100644
--- a/cron_mail_queue.php
+++ b/cron_mail_queue.php
@@ -53,7 +53,7 @@
// Process Mail Queue
-// Email Status:
+// Email Status:
// 0 Queued
// 1 Sending
// 2 Failed
@@ -102,20 +102,20 @@
);
if ($mail !== true) {
- // Update Message
+ // Update Message - Failure
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_failed_at = NOW(), email_attempts = 1 WHERE email_id = $email_id");
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Mail', notification = 'Failed to send email to $email_recipient_logging'");
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Mail', log_action = 'Error', log_description = 'Failed to send email to $email_recipient_logging regarding $email_subject_logging. $mail'");
} else {
- // Update Message
+ // Update Message - Success
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = 1 WHERE email_id = $email_id");
}
}
}
}
-//
+//
// Get Mail that failed to send and attempt to send Failed Mail up to 4 times every 30 mins
$sql_failed_queue = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_status = 2 AND email_attempts < 4 AND email_failed_at < NOW() + INTERVAL 30 MINUTE");
diff --git a/post/setting.php b/post/setting.php
index f5b18cf32..5e1c0fcae 100644
--- a/post/setting.php
+++ b/post/setting.php
@@ -151,7 +151,7 @@
validateCSRFToken($_POST['csrf_token']);
validateAdminRole();
-
+
$test_email = intval($_POST['test_email']);
if($test_email == 1) {
$email_from = sanitizeInput($config_mail_from_email);
@@ -328,7 +328,7 @@
if (isset($_POST['edit_favicon_settings'])) {
validateCSRFToken($_POST['csrf_token']);
-
+
validateAdminRole();
// Check to see if a file is attached
@@ -451,7 +451,7 @@
if (isset($_POST['edit_ai_settings'])) {
validateCSRFToken($_POST['csrf_token']);
-
+
validateAdminRole();
$provider = sanitizeInput($_POST['provider']);
@@ -538,10 +538,10 @@
$email_id = intval($_GET['send_failed_mail']);
- mysqli_query($mysqli,"UPDATE email_queue SET email_attempts = 3 WHERE email_id = $email_id");
+ mysqli_query($mysqli,"UPDATE email_queue SET email_status = 0, email_attempts = 3 WHERE email_id = $email_id");
// Logging
- mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Email', log_action = 'Send', log_description = '$session_name attempted to force send email queue id: $email_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
+ mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Email', log_action = 'Send', log_description = '$session_name attempted to force send email queue id: $email_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $email_id");
$_SESSION['alert_message'] = "Email Force Sent, give it a minute to resend";
@@ -549,6 +549,23 @@
}
+if (isset($_GET['cancel_mail'])) {
+
+ validateTechRole();
+
+ $email_id = intval($_GET['cancel_mail']);
+
+ mysqli_query($mysqli,"UPDATE email_queue SET email_status = 2, email_attempts = 99, email_failed_at = NOW() WHERE email_id = $email_id");
+
+ // Logging
+ mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Email', log_action = 'Cancel', log_description = '$session_name canceled send email queue id: $email_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $email_id");
+
+ $_SESSION['alert_message'] = "Email cancelled and marked as failed.";
+
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
+
+}
+
if (isset($_GET['download_database'])) {
validateCSRFToken($_GET['csrf_token']);
diff --git a/post/ticket.php b/post/ticket.php
index b278babdf..59e3d969b 100644
--- a/post/ticket.php
+++ b/post/ticket.php
@@ -1473,10 +1473,10 @@
mysqli_query(
$mysqli,
"UPDATE tickets SET
- ticket_schedule = '$schedule',
- ticket_onsite = '$onsite',
- ticket_status = 'Scheduled'
- WHERE ticket_id = $ticket_id"
+ ticket_schedule = '$schedule',
+ ticket_onsite = '$onsite',
+ ticket_status = 'Scheduled'
+ WHERE ticket_id = $ticket_id"
);
@@ -1499,7 +1499,6 @@
WHERE ticket_id = $ticket_id
");
-
$row = mysqli_fetch_array($sql);
$client_id = intval($row['ticket_client_id']);
@@ -1577,7 +1576,7 @@
'body' => mysqli_escape_string($mysqli, nullable_htmlentities("
Hello,
- Your ticket regarding $ticket_subject has been scheduled for $email_datetime.
+ The ticket regarding $ticket_subject has been scheduled for $email_datetime.