Ticket emails carry the conversation: the new message first, then earlier public replies newest first and the request, as short plain-text excerpts without pictures, cut when long, with the rest counted after four, never internal notes, archived replies or the portal's resolve, reopen and close lines; resolved, closed, work booked, watcher added, assigned to you, client replied and the SLA alerts all carry it, so resolving with the Resolve button or on the board no longer sends an empty Resolved email; the inbox preview line is the start of the message or what happened instead of the number and subject; the new ticket email to a client's colleagues shows what was asked for portal and agent tickets but never an emailed ticket's words, and the emailed-ticket confirmation still doesn't repeat them; the email parser cuts a plain-text reply at the reply line too; adds emailPlainText, ticketEmailHistory, ticketEmailExcerpt and ticketEmailPreview and a history block in emailHtml; changelog

This commit is contained in:
johnnyq
2026-10-24 13:27:48 -04:00
parent 9a793bee98
commit 96076d295e
4 changed files with 181 additions and 2 deletions

View File

@@ -1009,6 +1009,9 @@ If you are coming from 26.08 or earlier, the database update still has to be run
- A new ticket's email says when you will respond, from its SLA, and an Urgent or High one asks them to phone if it is holding them up.
- Resolved says when it closes by itself, with a button to view or reopen it. Closed asks how you did.
- The subjects are the same and the reply line stays at the top, so replies still go onto their ticket and are cut off where they were.
- Ticket emails carry the conversation: the new message first, then the earlier public replies, newest first, and the request at the end. Each one shows who wrote it and when, as a short excerpt: pictures are left out and long messages are cut short. After four replies the rest are counted. Internal notes never show. Resolved, Closed, Work booked, Watching, Assigned to you, Client replied and the SLA alerts all carry it, so an email says what the ticket is about even when nothing new was written.
- The line an inbox shows beside the subject is now the start of the message, or what happened ("We have marked ticket TCK-12 resolved."), where it used to repeat the number and subject.
- New ticket at their company, to the primary and technical contacts who asked, shows what was asked when it came from the portal or one of you. An emailed ticket's words are never sent on by themselves, as the sender of an email can be forged - "We have your email" doesn't repeat them either.
- Images in a reply point at your ITFlow, so they show, and anything in a reply that could run in the email is taken out.
- Scheduled work: the contact, the ticket's watchers and the assigned agent get the date, time and whether it is on site, with the calendar file as before. Cancelling it tells them the same way, and the calendar file takes it out of their calendar.
- Emails to your team are in the same look, each with an Open in ITFlow button:
@@ -1274,6 +1277,8 @@ If you are coming from 26.08 or earlier, the database update still has to be run
- API: `credentials/create` and `credentials/update` ignored `credential_vendor_id` and `credential_software_id`, and took another client's contact or asset. The vendor and license are linked now, and another client's contact, asset, vendor or license is left off.
- API: `assets/update` without `asset_ip`, `asset_mac` or `asset_network_id` wiped those on the asset's primary interface.
- API: `tickets/resolve` answered success False although it had resolved the ticket. `software/read` by `software_name` failed with a database error. `clients/create` without `client_currency_code` made a client with no currency - it gets the company's now. `certificates/create` said only that it failed - it says what was wrong. `clients/archive` logged as a contact being archived. A request that wasn't GET or POST printed its method back.
- Ticket emails: resolving a ticket with the Resolve button or on the board emailed the client a Resolved email with nothing about the ticket in it. It now carries the conversation.
- Email parser: a reply sent as plain text kept the whole email it quoted - it is now cut at the reply line, like an HTML reply.
- Ticket link: reopening a resolved ticket from it left the resolution SLA as it was, and closing it didn't stop the SLA clock. Both now work as they do from the client portal.
- Ticket link: a rating could be changed afterwards, or set to any word by editing the address, and the custom action for a rating never ran.
- Ticket link: the client's photo never showed on their own messages.
@@ -1869,6 +1874,7 @@ If you are coming from 26.08 or earlier, the database update still has to be run
- Security sweep: `includes/footer.php` falls back to `window.itflowAi = false` when `aiClientConfig()` throws (`admin/debug.php` closes the database before its footer). `reportCsv()` escapes only the report's name for the audit log, as `$session_name` is SQL-safe already. `bulk_edit_asset_interface_network` refuses a network id that no longer exists.
- Guest ticket page: `guest/guest_view_ticket.php` is built on the portal's ticket helpers in `client/functions.php` (`portalTicketState()`, `portalAvatarHtml()`, `portalDateTime()`, `portalTicketEventText()`) and sends `Referrer-Policy: no-referrer` (the key is in the address), `X-Frame-Options: DENY` and `frame-ancestors 'none'`. `ticketByGuestKey($ticket_id, $url_key)` (`functions/ticket.php`) returns `ticketRow()` only when the key matches exactly (`hash_equals()`); the page, the handlers and the new `guest/guest_ticket_attachment.php` use it, and `ticketGuestPath($row)` is the page's address from `guest/`. The attachment endpoint follows `client/ticket_attachment.php`'s rules (never an internal or archived reply's file, inline only for `getInlineViewableMimeTypes()`), never serves `Original-parsed-email.eml`, and logs each download.
- Guest ticket page: in `guest/guest_post.php`, `close_ticket`, `reopen_ticket` and `add_ticket_feedback` are POST only, with `ticket_id` and `url_key`; the GET forms are gone. Each acts once, on the state it expects, so a second press logs nothing. Reopen calls `resetTicketResolutionSla()` and `syncTicketSlaClock()` and `appNotify()`; close calls `syncTicketSlaClock()`. `add_ticket_feedback` takes Good or Bad only. `ticket_calendar` (GET) sends the booking's calendar file. `ticketScheduleRow($ticket_id)` and `ticketScheduleIcs($row, $schedule)` are what `ticketSetSchedule()` used to build inline, so both give the same UID and event. The CSS class `.itflow-portal-todo-wrap` lets a portal to-do row's title wrap instead of being cut off.
- Ticket emails: `emailHtml()` takes a `history` block (a heading and items of who, organisation, action, when and plain text, or a `gap` count) drawn after the button. `emailPlainText($html, $limit)` (`functions/email.php`) is HTML as plain text, keeping line breaks, dropping pictures and the reply line, and cut at a word. `ticketEmailHistory($row, $opts)` (`functions/ticket.php`) builds the history: public and client replies newest first, never internal, archived or the portal's "Ticket ... by X." lines, then the request. `skip` leaves out the reply the email shows and anything newer, `request` and `replies` choose the parts, and `limit` (4) caps the replies. `ticketEmailExcerpt()` takes off the parser's "Email from" line. `ticketEmailContent()` and `ticketAgentEmailContent()` add it per kind and set the preview line through `ticketEmailPreview()`. `ticketMailColleaguesNew()` shows the details unless `ticket_source` is Email. `cron/ticket_email_parser.php` also cuts a reply at a plain-text reply line, quoted or not.
### Library Updates

View File

@@ -187,6 +187,9 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
'',
$message
);
// A reply sent as plain text has the line without its <i>, often quoted ("> ") - cut there too, or the
// email it quotes, earlier messages and all, lands on the ticket
$message = preg_replace('/(?:&gt;\s*)*##-\s*Please\s+type\s+your\s+reply\s+above\s+this\s+line\s*-##.*$/is', '', $message);
// 2) Clean up the remaining message

View File

@@ -43,6 +43,9 @@ const EMAIL_REPLY_MARKER = '##- Please type your reply above this line -##';
* button ['label' => ..., 'url' => ..., 'show_url' => true to print the address under it,
* for a link that has to be copied whole]
* after paragraphs after the button, smaller
* history earlier messages, under a rule at the end - ['label' => the heading, 'items' => [...]],
* each item ['by', 'org', 'action', 'when', 'text' => plain text, 'client' => true for
* the client's side] or ['gap' => how many are left out here] (ticketEmailHistory())
* contact the foot's contact line, in place of the company's phone, email and website
* footnote a line under the card - why they got it
*/
@@ -142,6 +145,31 @@ function emailHtml(array $email) {
foreach ((array) ($email['after'] ?? []) as $text_value) {
$body .= '<p style="margin:0 0 12px;font-size:13px;line-height:1.55;color:' . $muted . ';">' . nl2br($e($text_value)) . '</p>';
}
// The earlier messages, quietly, after everything else - a grey edge for the client's side, blue for yours
if (!empty($email['history']['items'])) {
$items = '';
foreach ($email['history']['items'] as $item) {
if (isset($item['gap'])) {
$gap = intval($item['gap']);
$items .= '<p style="margin:0 0 14px;font-size:13px;color:' . $muted . ';">&middot;&middot;&middot; ' . $gap . ' earlier ' . ($gap === 1 ? 'message' : 'messages') . ' - see the ticket</p>';
continue;
}
$meta = '<strong style="color:' . $text . ';">' . $e($item['by'] ?? '') . '</strong>';
foreach (['org', 'action', 'when'] as $part) {
if (trim((string) ($item[$part] ?? '')) !== '') {
$meta .= ' &middot; ' . $e($item[$part]);
}
}
$items .= '<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="margin:0 0 14px;"><tr>'
. '<td style="border-left:3px solid ' . (!empty($item['client']) ? '#ced4da' : '#9ec5fe') . ';padding:1px 0 1px 12px;' . $font . '">'
. '<div style="margin:0 0 3px;font-size:12px;line-height:1.5;color:' . $muted . ';">' . $meta . '</div>'
. '<div style="font-size:14px;line-height:1.5;color:#495057;overflow-wrap:anywhere;word-break:break-word;">' . nl2br($e($item['text'] ?? '')) . '</div>'
. '</td></tr></table>';
}
$body .= '<div style="margin:8px 0 0;padding-top:16px;border-top:1px solid ' . $line . ';">'
. '<div style="margin:0 0 12px;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:' . $muted . ';">' . $e($email['history']['label'] ?? 'Earlier messages') . '</div>'
. $items . '</div>';
}
$contact = array_key_exists('contact', $email)
? (string) $email['contact']
@@ -274,6 +302,33 @@ function emailMessageHtml($html) {
return preg_replace('/<p(?=[\s>])(?![^>]*\bstyle=)/i', '<p style="margin:0 0 10px;"', $html);
}
/*
* HTML someone wrote as plain text - for an inbox's preview line and an
* email's earlier messages: line breaks kept, pictures dropped (a message
* that was only a picture says so), the reply line taken out, and with
* $limit, cut at a word near that many characters with an ellipsis.
*/
function emailPlainText($html, $limit = 0) {
$html = str_replace(EMAIL_REPLY_MARKER, '', (string) $html);
$html = preg_replace('#<(script|style|title|head)\b[^>]*>.*?</\1\s*>#is', '', $html);
$pictures = preg_match_all('#<img\b#i', $html);
// A paragraph ends with a blank line, anything else that breaks a line with one break
$html = preg_replace(['#<br\s*/?>#i', '#</p\s*>#i', '#</(div|li|tr|h[1-6]|blockquote|table|pre)\s*>#i', '#<li\b[^>]*>#i'], ["\n", "\n\n", "\n", '- '], $html);
$text = html_entity_decode(strip_tags($html), ENT_QUOTES | ENT_HTML5, 'UTF-8');
// Non-breaking and zero-width spaces too - unless the text isn't valid UTF-8, where /u gives up
$text = preg_replace("/[ \t\x{00A0}\x{200B}\x{200C}]+/u", ' ', $text) ?? preg_replace("/[ \t]+/", ' ', $text);
$text = trim((string) preg_replace(["/ *\n */", "/\n{3,}/"], ["\n", "\n\n"], $text));
if ($text === '' && $pictures) {
return $pictures === 1 ? '[A picture]' : "[$pictures pictures]";
}
if ($limit > 0 && mb_strlen($text) > $limit) {
$cut = mb_substr($text, 0, $limit);
$space = mb_strrpos($cut, ' ');
$text = rtrim($space !== false && $space > $limit * 0.6 ? mb_substr($cut, 0, $space) : $cut, " \n,.;:-") . '…';
}
return $text;
}
/**
* Queue an email - one per recipient, each greeted by name, each address once.
* $recipients: [['email' => ..., 'name' => ..., 'greet' => name to greet (or

View File

@@ -353,6 +353,90 @@ function ticketEmailSla($ticket_id) {
];
}
/*
* The conversation on a ticket, for the end of an email about it
* (emailHtml()'s history): its public replies newest first, and at the end
* the request it was opened with - each a short plain-text excerpt
* (ticketEmailExcerpt()), so a pasted screenshot or a long signature can't
* swell the email. Never an internal note, nor the lines the portal writes
* when a contact resolves, reopens or closes. $opts:
* label the heading - Earlier on this ticket
* skip the HTML of the reply the email itself shows - it, and anything newer, is left out
* replies false for the request alone
* request false leaves the request out, when the email shows it already
* limit how many replies at most (4) - the rest are counted, before the request
* [] when there is nothing earlier to show.
*/
function ticketEmailHistory(array $row, array $opts = []) {
global $mysqli;
$ticket_id = intval($row['ticket_id']);
$limit = max(0, intval($opts['limit'] ?? 4));
$company_name = (string) (billingCompany()['company_name'] ?? '');
$items = [];
$left_out = 0;
if ($opts['replies'] ?? true) {
$sql = mysqli_query($mysqli, "SELECT ticket_reply, ticket_reply_type, ticket_reply_created_at, contact_name, user_name FROM ticket_replies
LEFT JOIN users ON ticket_reply_type != 'Client' AND user_id = ticket_reply_by
LEFT JOIN contacts ON ticket_reply_type = 'Client' AND contact_id = ticket_reply_by
WHERE ticket_reply_ticket_id = $ticket_id AND ticket_reply_archived_at IS NULL AND ticket_reply_type IN ('Public', 'Client')
ORDER BY ticket_reply_id DESC");
$replies = mysqli_fetch_all($sql, MYSQLI_ASSOC);
// Only what came before the reply the email shows - that one is the newest, but for a preview's sample
$skip = (string) ($opts['skip'] ?? '');
if ($skip !== '') {
foreach ($replies as $i => $reply) {
if ((string) $reply['ticket_reply'] === $skip) {
$replies = array_slice($replies, $i + 1);
break;
}
}
}
foreach ($replies as $reply) {
$text = ticketEmailExcerpt($reply['ticket_reply']);
$client = $reply['ticket_reply_type'] === 'Client';
if ($text === '' || ($client && preg_match('/^Ticket (resolved|reopened|closed) by .{1,200}\.$/', $text))) {
continue;
}
if (count($items) >= $limit) {
$left_out++;
continue;
}
$items[] = [
'by' => $client ? ((string) $reply['contact_name'] ?: 'Client') : ((string) $reply['user_name'] ?: $company_name),
'org' => $client ? '' : $company_name,
'when' => date('D j M, g:i A', strtotime($reply['ticket_reply_created_at'])),
'text' => $text,
'client' => $client,
];
}
}
if (!($opts['request'] ?? true) && $left_out) {
$items[] = ['gap' => $left_out];
} elseif ($opts['request'] ?? true) {
$text = ticketEmailExcerpt($row['ticket_details'] ?? '');
if ($text !== '') {
if ($left_out) {
$items[] = ['gap' => $left_out];
}
$asked_by = trim((string) ($row['contact_name'] ?? ''));
$items[] = [
'by' => $asked_by !== '' ? $asked_by : 'The request',
'action' => $asked_by !== '' ? 'the request' : '',
'when' => date('D j M, g:i A', strtotime($row['ticket_created_at'])),
'text' => $text,
'client' => true,
];
}
}
return $items ? ['label' => (string) ($opts['label'] ?? 'Earlier on this ticket'), 'items' => $items] : [];
}
/** A ticket message as a short plain-text excerpt - without the "Email from: ... :-" line the email parser puts on what it saves. */
function ticketEmailExcerpt($html, $limit = 700) {
$html = preg_replace('#^\s*<i>\s*Email from:.*?</i>(\s*<br\s*/?>)*#is', '', (string) $html);
return emailPlainText($html, $limit);
}
/*
* What an email about a ticket says - emailHtml()'s fields (functions/email.php),
* all but who it is to and why they get it, which ticketMailSend() adds for
@@ -387,6 +471,7 @@ function ticketEmailContent(array $row, $kind, array $opts = []) {
if ($how === 'email') {
$email['title'] = 'We have your email';
$email['intro'] = ["Thank you - it is ticket $reference now, and we will reply to you here. To add anything, just reply to this email."];
// Never their own words back: the sender of an email can be forged, and an echo would carry whatever it said to them
} else {
$email['title'] = $how === 'scheduled' ? 'A scheduled ticket was opened for you' : 'We have opened a ticket for you';
$email['intro'] = [($how === 'scheduled' ? "Ticket $reference was opened for you, as scheduled." : "We have opened ticket $reference for you.")
@@ -403,6 +488,7 @@ function ticketEmailContent(array $row, $kind, array $opts = []) {
$email['message'] = ['html' => (string) ($opts['message'] ?? ''), 'label' => "$by replied"];
$email['summary'] = $summary;
$email['after'] = ['To answer, just reply to this email.'];
$email['history'] = ticketEmailHistory($row, ['skip' => (string) ($opts['message'] ?? '')]);
} elseif ($kind === 'resolved') {
$hours = intval($config_ticket_autoclose_hours);
$closes = $hours > 0 ? ' - it closes by itself after ' . ($hours % 24 === 0 ? ($hours / 24) . ' day' . ($hours === 24 ? '' : 's') : "$hours hours") : '';
@@ -413,6 +499,9 @@ function ticketEmailContent(array $row, $kind, array $opts = []) {
$email['message'] = ['html' => (string) ($opts['message'] ?? ''), 'label' => "$by wrote"];
$email['summary'] = $summary;
$email['button']['label'] = 'View or reopen it';
// Resolved from the button or the board there is no note - the conversation says what was done
$email['history'] = ticketEmailHistory($row, ['skip' => (string) ($opts['message'] ?? ''),
'label' => emailPlainText($opts['message'] ?? '') !== '' ? 'Earlier on this ticket' : 'The conversation']);
} elseif ($kind === 'closed') {
$email['marker'] = false;
$email['kind'] = 'Closed';
@@ -422,6 +511,7 @@ function ticketEmailContent(array $row, $kind, array $opts = []) {
$email['summary'] = $summary;
$email['button']['label'] = 'Tell us how we did';
$email['after'] = ['Need more help with this? Raise a new ticket - replies to this email do not reach us.'];
$email['history'] = ticketEmailHistory($row, ['limit' => 3, 'label' => 'The conversation']);
} elseif ($kind === 'scheduled') {
$cancelled = !empty($opts['cancelled']);
$email['kind'] = $cancelled ? 'Visit cancelled' : 'Work booked';
@@ -431,12 +521,30 @@ function ticketEmailContent(array $row, $kind, array $opts = []) {
? "The work booked on ticket $reference is cancelled - the calendar file with this email takes it out of your calendar. We will be in touch to book it again."
: "We have booked the work on ticket $reference for " . $opts['when'] . ". The calendar file with this email adds it to your calendar."];
$email['summary'] = $summary + ($cancelled ? [] : ['When' => (string) $opts['when'], 'Where' => !empty($row['ticket_onsite']) ? (trim((string) ($opts['where'] ?? '')) !== '' ? (string) $opts['where'] : 'Onsite') : 'Remote']);
$email['history'] = $cancelled ? [] : ticketEmailHistory($row, ['limit' => 2, 'label' => 'What it is about']);
} elseif ($kind === 'watcher') {
$email['kind'] = 'Watching';
$email['title'] = 'You were added to a ticket';
$email['intro'] = ["$by added you to ticket $reference" . (!empty($row['client_name']) ? ' for ' . $row['client_name'] : '') . ", so you will get its updates. To add anything, just reply to this email."];
$email['message'] = ['html' => (string) $row['ticket_details'], 'label' => 'Details'];
$email['summary'] = $summary;
$email['history'] = ticketEmailHistory($row, ['request' => false, 'label' => 'Replies so far']);
}
return ticketEmailPreview($email);
}
/*
* The inbox's preview line, beside the subject that already gives the number
* and title - the start of the message the email carries, or else its first
* line ("We have marked ticket TCK-12 resolved.").
*/
function ticketEmailPreview(array $email) {
$said = emailPlainText($email['message']['html'] ?? '', 140);
if ($said === '') {
$said = (string) (((array) ($email['intro'] ?? []))[0] ?? '');
}
if (trim($said) !== '') {
$email['preview'] = preg_replace('/\s+/', ' ', trim($said));
}
return $email;
}
@@ -549,6 +657,8 @@ function ticketMailColleaguesNew($ticket_id) {
$ticket_id = intval($ticket['ticket_id']);
$reference = ticketReference($ticket);
$raised_by = trim((string) $ticket['contact_name']) !== '' ? (string) $ticket['contact_name'] : 'We';
// What was asked - not for an emailed ticket, sent on by itself: a forged sender would have us carry their words to the client
$echo = (string) $ticket['ticket_source'] !== 'Email';
$sent = 0;
foreach (ticketColleagueRecipients($ticket_id, 'created') as $email => $colleague) {
$url = $colleague['portal'] ? "https://$config_base_url/client/ticket.php?id=$ticket_id" : ticketEmailUrl($ticket);
@@ -556,9 +666,10 @@ function ticketMailColleaguesNew($ticket_id) {
'email' => $email, 'name' => $colleague['name'],
'footnote' => "You get this because you asked to hear about new tickets at " . $colleague['client_name'] . ($colleague['portal'] ? ' - change that under Your account in the client portal.' : '.'),
]], "New ticket - [$reference] - " . $ticket['ticket_subject'], [
'kind' => 'New ticket', 'tone' => 'primary', 'preview' => "$reference - " . $ticket['ticket_subject'],
'kind' => 'New ticket', 'tone' => 'primary', 'preview' => ($echo ? preg_replace('/\s+/', ' ', emailPlainText($ticket['ticket_details'], 140)) : '') ?: "$reference - " . $ticket['ticket_subject'],
'title' => "New ticket at " . $colleague['client_name'],
'intro' => ["$raised_by raised a ticket at " . $colleague['client_name'] . '.'],
'message' => ['html' => $echo ? (string) $ticket['ticket_details'] : '', 'label' => 'Details'],
'summary' => ['Ticket' => $reference, 'Subject' => (string) $ticket['ticket_subject'], 'Priority' => (string) $ticket['ticket_priority'], 'Raised by' => $raised_by === 'We' ? 'Us' : $raised_by],
'button' => ['label' => $colleague['portal'] ? 'View it in the portal' : 'View the ticket', 'url' => $url],
'contact' => ticketEmailContactLine(),
@@ -658,10 +769,12 @@ function ticketAgentEmailContent(array $row, $kind, array $opts = []) {
$email['intro'] = [($by !== '' ? $by : 'The client') . " replied to $reference$how."];
$email['message'] = ['html' => (string) ($opts['message'] ?? ''), 'label' => ($by !== '' ? $by : 'They') . ' wrote'];
$email['after'] = ['Answer it in ITFlow, so the client gets your reply.'];
$email['history'] = ticketEmailHistory($row, ['skip' => (string) ($opts['message'] ?? '')]);
} elseif ($kind === 'assigned') {
$email['kind'] = 'Assigned to you';
$email['intro'] = [($by !== '' ? $by : 'Someone') . " assigned $reference to you."];
$email['message'] = ['html' => (string) $row['ticket_details'], 'label' => 'Details'];
$email['history'] = ticketEmailHistory($row, ['request' => false, 'label' => 'Replies so far']);
} elseif ($kind === 'scheduled') {
$cancelled = !empty($opts['cancelled']);
$email['kind'] = $cancelled ? 'Visit cancelled' : 'Work booked';
@@ -669,6 +782,7 @@ function ticketAgentEmailContent(array $row, $kind, array $opts = []) {
$email['intro'] = [$cancelled ? "The work booked on $reference is cancelled - the calendar file with this email takes it out of your calendar." : "$reference is booked for " . $opts['when'] . " - the calendar file with this email adds it to your calendar."];
if (!$cancelled) {
$email['summary'] += ['When' => (string) $opts['when'], 'Where' => !empty($row['ticket_onsite']) ? (trim((string) ($opts['where'] ?? '')) !== '' ? (string) $opts['where'] : 'Onsite') : 'Remote'];
$email['history'] = ticketEmailHistory($row, ['limit' => 2, 'label' => 'What it is about']);
}
} elseif ($kind === 'sla') {
$track = ($opts['track'] ?? 'response') === 'resolution' ? 'resolution' : 'response';
@@ -680,8 +794,9 @@ function ticketAgentEmailContent(array $row, $kind, array $opts = []) {
? "The $track due on $reference by $due was missed."
: "$reference is close to its $track SLA - it is due by $due."];
$email['summary'] += ['Assigned' => !empty($row['user_name']) ? (string) $row['user_name'] : 'Nobody', ucfirst($track) . ' due' => $due];
$email['history'] = ticketEmailHistory($row, ['limit' => 3, 'label' => 'The conversation']);
}
return $email;
return ticketEmailPreview($email);
}
/** Queue an email to agents (ticketAgentEmailContent()) from the ticket mailbox - [['email', 'name', 'footnote'], ...]. How many went. */