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:
67
admin/post/email_ignored_sender.php
Normal file
67
admin/post/email_ignored_sender.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Admin > Ignored Senders (admin/email_ignored_senders.php, functions/mail_ignore.php): add_ignored_sender and
|
||||
* edit_ignored_sender keep an address or a domain whose email the ticket mailbox sets aside, and why - an address or
|
||||
* domain that isn't one, or one there already, comes back saying so; delete_ignored_sender stops ignoring it. One
|
||||
* that takes contacts' or a client's email is saved, saying so.
|
||||
*/
|
||||
|
||||
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
||||
|
||||
if (isset($_POST['add_ignored_sender']) || isset($_POST['edit_ignored_sender'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
if (!mailIgnoreReady()) {
|
||||
flashAlert("Ignored senders need the database update", 'error');
|
||||
redirect('email_ignored_senders.php');
|
||||
}
|
||||
|
||||
$editing = isset($_POST['edit_ignored_sender']);
|
||||
$id = $editing ? intval($_POST['ignored_sender_id'] ?? 0) : 0;
|
||||
$rule = mailIgnoreClean($_POST['ignored_sender_match'] ?? '');
|
||||
$note = mb_substr(trim((string) ($_POST['ignored_sender_note'] ?? '')), 0, 255);
|
||||
if (!$rule) {
|
||||
flashAlert("<strong>" . escapeHtml(trim((string) ($_POST['ignored_sender_match'] ?? ''))) . "</strong> isn't an email address or a domain", 'error');
|
||||
redirect();
|
||||
}
|
||||
$match_sql = escapeSql($rule['match']);
|
||||
if (mysqli_num_rows(mysqli_query($mysqli, "SELECT 1 FROM email_ignored_senders WHERE ignored_sender_match = '$match_sql' AND ignored_sender_id <> $id"))) {
|
||||
flashAlert("<strong>" . escapeHtml($rule['match']) . "</strong> is ignored already", 'error');
|
||||
redirect();
|
||||
}
|
||||
|
||||
if ($editing) {
|
||||
mysqli_query($mysqli, "UPDATE email_ignored_senders SET ignored_sender_match = '$match_sql', ignored_sender_note = '" . escapeSql($note) . "' WHERE ignored_sender_id = $id");
|
||||
} else {
|
||||
$id = mailIgnoreAdd($rule, $note, $session_user_id);
|
||||
}
|
||||
|
||||
$reach = mailIgnoreReachText(mailIgnoreReach($rule['match']));
|
||||
logAudit("Settings", $editing ? "Edit" : "Create", "$session_name set email from $match_sql to be ignored");
|
||||
flashAlert("Email from <strong>" . escapeHtml($rule['kind'] === 'domain' ? '@' . $rule['match'] : $rule['match']) . "</strong> is set aside from now on" . ($reach !== '' ? " - $reach" : ''), $reach !== '' ? 'warning' : 'success');
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['delete_ignored_sender'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
$id = intval($_GET['delete_ignored_sender']);
|
||||
$match = (string) (mysqli_fetch_row(mysqli_query($mysqli, "SELECT ignored_sender_match FROM email_ignored_senders WHERE ignored_sender_id = $id"))[0] ?? '');
|
||||
if ($match === '') {
|
||||
flashAlert("That ignored sender isn't there any more", 'error');
|
||||
redirect();
|
||||
}
|
||||
|
||||
mysqli_query($mysqli, "DELETE FROM email_ignored_senders WHERE ignored_sender_id = $id");
|
||||
|
||||
logAudit("Settings", "Delete", "$session_name stopped ignoring email from " . escapeSql($match));
|
||||
flashAlert("Email from <strong>" . escapeHtml($match) . "</strong> is read as usual again", 'error');
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user