Cockatrice/servatrice
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
..
docker Docker-compose setup for Servatrice (#3887) 2020-03-16 21:40:58 -04:00
migrations [Server] Add deck share links and public deck visibility (#7241) 2026-09-20 20:22:16 +02:00
mysql-storage Docker-Compose support for Windows (#3974) 2020-05-08 15:22:39 -04:00
resources Update macOS Monterey app icon (#4805) 2023-08-06 17:46:03 -04:00
scripts Add Discord account registration monitor (#7013) 2026-06-21 01:09:57 -04:00
src [SMTP] Add reliable email delivery with retry and database-backed queue (#7240) 2026-10-11 20:59:32 +02:00
check_schema_version.sh update format.sh (#6240) 2025-11-07 15:00:39 +01:00
CMakeLists.txt [CI] Publish a gcovr line-coverage report from the test run (#7404) 2026-10-11 15:05:28 +02:00
servatrice.desktop Servatrice: open in a terminal window when started from the menu 2014-10-11 13:38:07 +02:00
servatrice.ini.example [SMTP] Add reliable email delivery with retry and database-backed queue (#7240) 2026-10-11 20:59:32 +02:00
servatrice.qrc Renamed resources 2014-10-07 16:49:40 +02:00
servatrice.rc Servatrice logo 2014-10-06 21:04:37 +02:00
servatrice.sql [Server] Add deck share links and public deck visibility (#7241) 2026-09-20 20:22:16 +02:00