Cockatrice/servatrice/src/smtp
BruebachL 8968709642
[SMTP] Add reliable email delivery with retry and database-backed queue (#7240)
* [SMTP] Add reliable email delivery with retry and database-backed queue

Rework the SMTP client from fire-and-forget sending into a persistent
queue with exponential backoff and per-message retry budget, backed by
the existing database rows as the durable source of truth.

- Keep pending emails in an in-memory queue with attempts/backoff
  tracking; enqueue without deleting database rows, and only remove the
  row once delivery is confirmed via the mailDelivered signal.
- Add exponential backoff (doubling, capped at 30 min) between delivery
  attempts, bounded by new smtp/maxretries and smtp/retrydelay settings.
- Track connection-layer failures (connect/auth/encrypt) with their own
  backoff; route failures to recordFailed/recordConnectionFailure so
  undeliverable mail eventually drops from the queue instead of
  retrying forever.
- Treat rejected recipients/senders as permanent failures.
- Rebuild the SMTP buffer from the authoritative queue before each send
  via a new QxtSmtp::reset() so reconnects never duplicate deliveries.
- Start the idle timeout after authentication, not on TCP connect, so
  slow SSL/STARTTLS handshakes are not cut short.

* [SMTP] Fix retry accounting, backoff reset, and token dedupe

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-10-11 20:59:32 +02:00
..
qxtglobal.h Fix compilation of servatrice with mdvc 2015-08-09 18:17:10 +02:00
qxthmac.cpp use qt6 in arch builds (#4691) 2022-10-31 23:26:13 +01:00
qxthmac.h Drop Qt4, libgcrypt, qtmobility dependencies 2016-05-11 12:45:58 +02:00
qxtmail_p.h remove dependency on deprecated qt5 libraries for qt6 (#4692) 2022-10-31 23:24:11 +01:00
qxtmailattachment.cpp replace foreach macro with standard for each loop (#5485) 2025-01-17 05:18:15 +00:00
qxtmailattachment.h Search full subdirectory for custom databases (#4137) 2020-11-22 20:06:25 -05:00
qxtmailmessage.cpp Docs: Use Doxygen \todo comments (#6421) 2025-12-15 00:13:16 +01:00
qxtmailmessage.h fix QByteArray::append(QString) deprecation in qt 5.15.1 (#4102) 2020-09-22 16:09:48 -04:00
qxtsmtp.cpp [SMTP] Add reliable email delivery with retry and database-backed queue (#7240) 2026-10-11 20:59:32 +02:00
qxtsmtp.h [SMTP] Add reliable email delivery with retry and database-backed queue (#7240) 2026-10-11 20:59:32 +02:00
qxtsmtp_p.h Fix compilation under OSX with homebrew's qt5.5 2015-07-25 19:28:30 +02:00