Settings > Tickets, Email to ticket. * Asked again with ?try=1, it answers with just the result, which the window * puts under the form. */ require_once '../../includes/modal_header.php'; /** The result - the steps, and where the email ends up. */ function ticketMailTryHtml(array $result) { [$icon, $tone, $title, $text] = $result['outcome']; $html = '
    '; foreach ($result['steps'] as [$question, $answer]) { $html .= '
  1. ' . escapeHtml($question) . '' . escapeHtml($answer) . '
  2. '; } $html .= '
'; $html .= '
' . '
' . escapeHtml($title) . '
' . ($text !== '' ? '
' . escapeHtml($text) . '
' : '') . '
'; return $html; } if (isset($_GET['try'])) { $from = trim((string) ($_GET['from'] ?? '')); if (!filter_var($from, FILTER_VALIDATE_EMAIL)) { echo json_encode(['result' => '
' . ($from === '' ? 'Type who it is from.' : '' . escapeHtml($from) . ' is not an email address.') . '
']); exit; } echo json_encode(['result' => ticketMailTryHtml(ticketMailTry($from, (string) ($_GET['subject'] ?? ''), !empty($_GET['auto'])))]); exit; } ob_start(); ?>