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:
@@ -561,6 +561,10 @@ function emailInlineImages($html, array $ticket = []) {
|
||||
* itself) - headers saying so, so it isn't answered (ticketMailAutoHeaders())
|
||||
* bulk an email to many - the contacts or clients list's Email - which the mail queue
|
||||
* sends after everything else (email_queue.email_bulk)
|
||||
* about what a billing email is about - invoice:12, quote:7 (email_queue.email_about) - so
|
||||
* a bounce goes in its history (mailQueueBounced())
|
||||
* Each email has a Message-ID of its own (email_queue.email_message_id, 4.3.5) - a ticket's from its
|
||||
* conversation, the rest made here (emailMessageId()) - so a bounce finds the email it was about.
|
||||
* Who it was queued to, "Name (email)" - the copied in too: only those that went in the queue
|
||||
* (addToMailQueue()). Nothing is queued without mail set up. The subject is cut to fit (emailFit()).
|
||||
*/
|
||||
@@ -607,6 +611,10 @@ function emailQueue(array $recipients, $subject, array $email, array $opts = [])
|
||||
// Its own headers - a List-Unsubscribe for its link - with the conversation's and the automatic ones
|
||||
$headers = ($thread !== null ? ticketMailHeaders($thread_id, (string) $from['email'], $thread) : []) + $auto_headers + (!$together ? (array) ($recipient['headers'] ?? []) : [])
|
||||
+ ($reply_to !== '' ? ['Reply-To' => $reply_to] : []);
|
||||
// Its own Message-ID, for a bounce to find it by - a ticket's conversation made one already
|
||||
if (!isset($headers['Message-ID']) && mailQueueBounceReady()) {
|
||||
$headers['Message-ID'] = '<' . emailMessageId((string) $from['email']) . '>';
|
||||
}
|
||||
$went = [];
|
||||
foreach (array_merge([$recipient], $cc) as $person) {
|
||||
$went[strtolower($person['email'])] = $person['name'] !== '' ? $person['name'] . ' (' . $person['email'] . ')' : $person['email'];
|
||||
@@ -635,6 +643,7 @@ function emailQueue(array $recipients, $subject, array $email, array $opts = [])
|
||||
+ (intval($opts['ticket_reply_id'] ?? 0) > 0 && ticketReplyEmailReady() ? ['ticket_reply_id' => intval($opts['ticket_reply_id'])] : [])
|
||||
+ (!empty($opts['sensitive']) ? ['sensitive' => 1] : [])
|
||||
+ (!empty($opts['bulk']) ? ['bulk' => 1] : [])
|
||||
+ (!empty($opts['about']) ? ['about' => (string) $opts['about']] : [])
|
||||
+ ($cc_list ? ['cc' => $cc_list] : [])
|
||||
+ ($headers ? ['headers' => $headers] : []);
|
||||
// Each on its own, so who it went to is only those queued - one that couldn't be is logged (addToMailQueue())
|
||||
@@ -645,6 +654,20 @@ function emailQueue(array $recipients, $subject, array $email, array $opts = [])
|
||||
return array_values($sent);
|
||||
}
|
||||
|
||||
/*
|
||||
* A new Message-ID - without its <> - at the domain of $from_email, or else ITFlow's own address: itflow.q.<random>@domain.
|
||||
* The conversation of a ticket makes its own (ticketMailHeaders()).
|
||||
*/
|
||||
function emailMessageId($from_email) {
|
||||
global $config_base_url;
|
||||
$from_email = (string) $from_email;
|
||||
$domain = strtolower(trim(substr($from_email, strrpos($from_email, '@') !== false ? strrpos($from_email, '@') + 1 : strlen($from_email))));
|
||||
if (!preg_match('/^[a-z0-9.-]+\.[a-z]{2,}$/', $domain)) {
|
||||
$domain = preg_replace('/[^a-z0-9.-]/', '', strtolower((string) parse_url('https://' . $config_base_url, PHP_URL_HOST))) ?: 'itflow.invalid';
|
||||
}
|
||||
return 'itflow.q.' . bin2hex(random_bytes(12)) . '@' . $domain;
|
||||
}
|
||||
|
||||
/*
|
||||
* $text cut to the $length characters a column of the mail queue holds - its subject and names (255) -
|
||||
* with an ellipsis. A ticket's subject can be 500 characters, and an email about one too long for
|
||||
|
||||
Reference in New Issue
Block a user