mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 00:59:03 +00:00
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:
@@ -1053,20 +1053,26 @@ function ticketReplyEmailStates(array $rows) {
|
||||
return array_map(function ($state) { $state['to'] = array_values($state['to']); return $state; }, $states);
|
||||
}
|
||||
$sql = mysqli_query($mysqli, "SELECT email_ticket_reply_id, email_recipient, email_recipient_name, " . (ticketMailThreadReady() ? 'email_cc' : "'' AS email_cc") . ",
|
||||
email_status, email_attempts, email_queued_at, email_failed_at, email_sent_at, email_error
|
||||
email_status, email_attempts, email_queued_at, email_failed_at, email_sent_at, email_error" . mailQueueBounceColumns() . "
|
||||
FROM email_queue WHERE email_ticket_reply_id IN (" . implode(',', array_keys($states)) . ") ORDER BY email_id");
|
||||
while ($sql && ($email = mysqli_fetch_assoc($sql))) {
|
||||
$reply_id = intval($email['email_ticket_reply_id']);
|
||||
$state = mailQueueState($email);
|
||||
// Bounced for some on it - the rest got it (mailQueueBounced())
|
||||
$got_it = $state['key'] === 'bounced' ? mailQueueState(['email_bounced_at' => null] + $email) : $state;
|
||||
// Those copied in went, or didn't, with it
|
||||
$people = array_merge([['email' => (string) $email['email_recipient'], 'name' => (string) $email['email_recipient_name'] !== (string) $email['email_recipient'] ? (string) $email['email_recipient_name'] : '']],
|
||||
mailQueueCc($email['email_cc']));
|
||||
foreach ($people as $person) {
|
||||
$address = strtolower($person['email']);
|
||||
$person_state = $state;
|
||||
if ($state['key'] === 'bounced') {
|
||||
$person_state = array_key_exists($address, $state['bounce']) ? ['error' => mailQueueErrorText($state['bounce'][$address])] + $state : $got_it;
|
||||
}
|
||||
$states[$reply_id]['to'][$address] = [
|
||||
'email' => $person['email'],
|
||||
'name' => $states[$reply_id]['to'][$address]['name'] ?? $person['name'],
|
||||
'state' => $state,
|
||||
'state' => $person_state,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1076,6 +1082,8 @@ function ticketReplyEmailStates(array $rows) {
|
||||
$key = 'gone';
|
||||
} elseif (in_array('failed', $keys, true)) {
|
||||
$key = 'failed';
|
||||
} elseif (in_array('bounced', $keys, true)) {
|
||||
$key = 'bounced';
|
||||
} elseif (array_intersect(['waiting', 'sending', 'retrying'], $keys)) {
|
||||
$key = 'waiting';
|
||||
} elseif (!in_array('sent', $keys, true)) {
|
||||
@@ -1846,6 +1854,9 @@ function ticketReplyEmailHtml($reply_id, array $state, $queue_url = '') {
|
||||
$failed = count(array_filter($to, function ($recipient) {
|
||||
return ($recipient['state']['key'] ?? '') === 'failed';
|
||||
}));
|
||||
$bounced = count(array_filter($to, function ($recipient) {
|
||||
return ($recipient['state']['key'] ?? '') === 'bounced';
|
||||
}));
|
||||
switch ($state['key'] ?? 'gone') {
|
||||
case 'sent':
|
||||
[$icon, $text, $title] = ['fa-check text-success', "Emailed to $first", 'Sent'];
|
||||
@@ -1860,6 +1871,10 @@ function ticketReplyEmailHtml($reply_id, array $state, $queue_url = '') {
|
||||
case 'cancelled':
|
||||
[$icon, $text, $title] = ['fa-ban', "Email to $first cancelled", 'Cancelled'];
|
||||
break;
|
||||
case 'bounced':
|
||||
[$icon, $text, $title] = ['fa-reply text-danger', $bounced === count($to) ? "<span class=\"text-danger\">Email to $first bounced</span>"
|
||||
: "Emailed to $first <span class=\"text-danger\">· $bounced bounced</span>", 'Bounced'];
|
||||
break;
|
||||
default:
|
||||
[$icon, $text, $title] = ['fa-paper-plane', "Emailed to $first", ''];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user