mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 09:09:01 +00:00
Mail review stage 1: people copied in on an email become a ticket's CCs only from the email that raises it or a reply to one of its emails, not a reply matched by the number in its subject alone; a subject too long for the mail queue is cut to fit and an email the queue turns away is logged rather than stopping the page or the mailbox; emailed files use the same list as attached ones, which gains heic, heif, tif, tiff, eml, xlsm, ppt, rtf and log, with an internal note naming any file left out; names with an apostrophe escaped once; 26.12.3 changelog
This commit is contained in:
@@ -803,10 +803,16 @@ function updateChangelogHtml(string $markdown): string
|
||||
return $html;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put emails in the queue (email_queue) - $data, each value SQL-escaped already. How many went in: one that
|
||||
* can't - too long for a column under strict SQL mode, the database gone for a moment - is logged (App Logs,
|
||||
* Mail) and left out, rather than ending the page or the job queuing it after the work it is about was saved.
|
||||
*/
|
||||
function addToMailQueue($data) {
|
||||
|
||||
global $mysqli;
|
||||
|
||||
$queued = 0;
|
||||
foreach ($data as $email) {
|
||||
$from = (string) $email['from'];
|
||||
$from_name = (string) $email['from_name'];
|
||||
@@ -861,10 +867,26 @@ function addToMailQueue($data) {
|
||||
. (!empty($email['headers']) ? ", email_headers = '" . mysqli_real_escape_string($mysqli, json_encode((array) $email['headers'], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) . "'" : '');
|
||||
}
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO email_queue SET email_recipient = '$recipient', email_recipient_name = '$recipient_name', email_from = '$from', email_from_name = '$from_name', email_subject = '$subject', email_content = '$body', email_queued_at = $queued_at, email_cal_str = '$cal_str', email_attachments = '$attachments'$ticket_reply_sql$sensitive_sql$thread_sql");
|
||||
$error = '';
|
||||
try {
|
||||
$inserted = mysqli_query($mysqli, "INSERT INTO email_queue SET email_recipient = '$recipient', email_recipient_name = '$recipient_name', email_from = '$from', email_from_name = '$from_name', email_subject = '$subject', email_content = '$body', email_queued_at = $queued_at, email_cal_str = '$cal_str', email_attachments = '$attachments'$ticket_reply_sql$sensitive_sql$thread_sql");
|
||||
$error = $inserted ? '' : mysqli_error($mysqli);
|
||||
} catch (\mysqli_sql_exception $e) {
|
||||
$inserted = false;
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
if ($inserted) {
|
||||
$queued++;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
logApp("Mail", "error", "An email to " . stripslashes($recipient) . " couldn't be queued, so it wasn't sent - " . ($error !== '' ? $error : 'the database turned it away') . ". Subject: " . stripslashes($subject));
|
||||
} catch (\Throwable $e) {
|
||||
error_log("ITFlow: an email to " . stripslashes($recipient) . " couldn't be queued - $error");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return $queued;
|
||||
}
|
||||
|
||||
function getTicketCalendarUid($ticket_id) {
|
||||
|
||||
Reference in New Issue
Block a user