Shared support mailbox: with From unknown senders too off the email parser moves out of the inbox only what is ITFlow's, leaving flagged in the inbox a bounce or delay notice that is not about a ticket, an email ITFlow sent or a contact, a stranger's out-of-office reply that answers no email ITFlow sent, and email from the mailbox's own address that ITFlow did not send, which is still never a ticket; ITFlow's own email is told by its Message-ID, the mail queue, a ticket number in the subject or a ticket email it answers; nothing changes with unknown senders on; Try an Email says what is left; 26.12.3 changelog

This commit is contained in:
johnnyq
2026-12-01 11:52:00 -05:00
parent 0da838103e
commit 89645add5e
5 changed files with 126 additions and 42 deletions

View File

@@ -201,16 +201,11 @@ function mailQueueBounceColumns() {
}
/*
* A mail server's bounce (addBounce(), cron/ticket_email_parser.php) for the email it was about - found by its Message-ID
* ($message_id, cleaned), else the latest sent in the last week to one of the addresses it failed for, with its subject
* ($subject, raw) - only ones that went (Sent). $failed is [address => why]. Marked Bounced, for those addresses - and a
* billing email's history says so, once for each address. The row as it was, or null when none is found.
*
* A report often names an address the email wasn't sent to - their mail is sent on to another mailbox, or the address is
* an alias - or names nobody. On an email to one person it is theirs, saying where it came back from. On one to several,
* which of them it was for can't be told: nobody on it is marked, and the address the report names is kept as it is.
* The sent email a mail server's bounce is about - by its Message-ID ($message_id, cleaned), else the latest sent in the
* last week to one of the addresses it failed for ($failed, [address => why]) with its subject ($subject, raw). Its row,
* or null - nothing is marked (mailQueueBounced() does that).
*/
function mailQueueBounced($message_id, array $failed, $subject = '') {
function mailQueueBounceRow($message_id, array $failed, $subject = '') {
global $mysqli;
if (!mailQueueBounceReady()) {
return null;
@@ -227,6 +222,22 @@ function mailQueueBounced($message_id, array $failed, $subject = '') {
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT $columns FROM email_queue WHERE email_status = 3 AND email_sent_at > NOW() - INTERVAL 7 DAY
AND email_subject = '" . mysqli_real_escape_string($mysqli, emailFit((string) $subject)) . "' AND LOWER(email_recipient) IN ($addresses) ORDER BY email_id DESC LIMIT 1"));
}
return $row ?: null;
}
/*
* A mail server's bounce (addBounce(), cron/ticket_email_parser.php) for the email it was about - found by its Message-ID
* ($message_id, cleaned), else the latest sent in the last week to one of the addresses it failed for, with its subject
* ($subject, raw) - only ones that went (Sent). $failed is [address => why]. Marked Bounced, for those addresses - and a
* billing email's history says so, once for each address. The row as it was, or null when none is found.
*
* A report often names an address the email wasn't sent to - their mail is sent on to another mailbox, or the address is
* an alias - or names nobody. On an email to one person it is theirs, saying where it came back from. On one to several,
* which of them it was for can't be told: nobody on it is marked, and the address the report names is kept as it is.
*/
function mailQueueBounced($message_id, array $failed, $subject = '') {
global $mysqli;
$row = mailQueueBounceRow($message_id, $failed, $subject);
if (!$row) {
return null;
}