Mail queue keeps what a sent email said: only an email with a link or code that opens something - a shared login and its code, a portal or agent invite, a password link, a contract to sign or a task to approve - is cleared once sent, and a day after it was queued if it failed or was cancelled; emailQueue gains a sensitive option set by those senders, cron marks sent email with mailQueueSentSql, nightly runs mailQueueClearSensitive, and a cleared email can't be retried; database 3.7.1 adds email_queue.email_sensitive and marks email waiting at the update; 26.11.9 changelog entries

This commit is contained in:
johnnyq
2026-11-16 18:48:57 -05:00
parent 8784c50abe
commit c2eb55c8dc
17 changed files with 107 additions and 30 deletions

View File

@@ -429,8 +429,8 @@ if (mysqli_num_rows($sql_queue) > 0) {
(string)$config_mail_oauth_access_token_expires_at
);
// Scrub the body on delivery - it can carry share decryption keys and temporary passwords
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = 1, email_content = '', email_cal_str = '', email_attachments = ''" . mailQueueErrorSql(null) . " WHERE email_id = $email_id");
// Sent - one with a link or code that opens something is cleared now (mailQueueSentSql())
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = 1" . mailQueueSentSql() . mailQueueErrorSql(null) . " WHERE email_id = $email_id");
} catch (\Throwable $e) {
// Anything that stops this one email - not only PHPMailer's own Exception, which is what Exception names
@@ -511,8 +511,8 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
(string)$config_mail_oauth_access_token_expires_at
);
// Scrub the body on delivery - it can carry share decryption keys and temporary passwords
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = $email_attempts, email_content = '', email_cal_str = '', email_attachments = ''" . mailQueueErrorSql(null) . " WHERE email_id = $email_id");
// Sent - one with a link or code that opens something is cleared now (mailQueueSentSql())
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = $email_attempts" . mailQueueSentSql() . mailQueueErrorSql(null) . " WHERE email_id = $email_id");
} catch (\Throwable $e) {
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_failed_at = NOW(), email_attempts = $email_attempts" . mailQueueErrorSql($e->getMessage()) . " WHERE email_id = $email_id");