Mail review stage 8: Admin > Ignored Senders lists addresses and domains whose email the ticket mailbox sets aside with no ticket, reply, answer or Unprocessed Email entry, a domain taking its subdomains, each counting what it set aside and saving one that takes a contact's or client's email saying so; Ignore Sender in Unprocessed Email ignores the address or its domain and dismisses the others waiting, leaving contacts, client domains and public domains to an admin; Try an Email has the step; every queued email gets its own Message-ID and invoice and quote emails say what they are about, so a bounce marks the email it came back about as Bounced with the mail server's reason in a new Mail Queue tab, on the ticket reply for those it names and in the invoice or quote history, matched by address and subject when the report has no Message-ID; .gitignore leaves out uploads/mail_unprocessed and uploads/kb (database 4.3.5); 26.12.3 changelog

This commit is contained in:
johnnyq
2026-12-01 00:06:27 -05:00
parent 812c4ae9c2
commit d2d9732efb
31 changed files with 878 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
/*
* ITFlow - POST handlers for Tickets > Unprocessed Email (agent/email_unprocessed.php, functions/mail_unprocessed.php):
* Make a Ticket, Add to a Ticket, Try Again and Dismiss - one at a time or Bulk Action - and Download .eml. A ticket, a
* Make a Ticket, Add to a Ticket, Try Again and Dismiss - one at a time or Bulk Action - Ignore Sender, and Download .eml. A ticket, a
* reply or a try again is asked of the email parser, which takes the email from its copy within a minute.
*/
@@ -88,6 +88,40 @@ if (isset($_POST['unprocessed_email_reply'])) {
}
// Ignore Sender - its address, or everyone at its domain, set aside from now on (functions/mail_ignore.php); this one
// dismissed, and the others waiting from them if asked. Never a contact's address, a client's domain, or one anyone can
// have an address at - those are an admin's, in Admin > Ignored Senders
if (isset($_POST['ignore_unprocessed_sender'])) {
validateCSRFToken();
enforceUserPermission('module_support', 2);
$row = unprocessedEmailForRequest($_POST['email_unprocessed_id'] ?? 0);
$from = strtolower(trim((string) $row['email_unprocessed_from_email']));
if (!mailIgnoreReady() || !filter_var($from, FILTER_VALIDATE_EMAIL)) {
flashAlert("That email has no sender address to ignore", 'error');
redirect();
}
$domain = substr($from, strrpos($from, '@') + 1);
$match = ($_POST['ignore'] ?? '') === 'domain' ? $domain : $from;
$reach = mailIgnoreReach($match);
if ($reach['contacts'] || $reach['clients'] || ($match === $domain && in_array($domain, EMAIL_PUBLIC_DOMAINS, true))) {
flashAlert("<strong>" . escapeHtml($match) . "</strong> can't be ignored from here - " . ($reach['contacts'] || $reach['clients'] ? "it would set aside contacts' email" : "anyone can have an address there")
. ". An admin can, in Admin &gt; Ignored Senders", 'error');
redirect();
}
mailIgnoreAdd(mailIgnoreClean($match), trim((string) ($_POST['ignored_sender_note'] ?? '')) !== '' ? $_POST['ignored_sender_note'] : 'From Unprocessed Email', $session_user_id);
mailUnprocessedDecide([$row['email_unprocessed_id']], 'dismiss', [], $session_user_id);
$others = !empty($_POST['dismiss_others']) ? mailIgnoreDismissWaiting($match, $session_user_id) : 0;
logAudit("Email", "Unprocessed", "$session_name ignored email from " . escapeSql($match));
flashAlert("Email from <strong>" . escapeHtml($match === $domain ? "@$domain" : $from) . "</strong> is set aside from now on" . ($others ? " - and $others more waiting from them dismissed" : ''));
redirect();
}
// Try Again or Dismiss - one, from its menu
if (isset($_GET['unprocessed_email'])) {