mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-25 11:56:11 -07:00
[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.
This commit is contained in:
parent
4e9d148163
commit
c49f0d162b
7 changed files with 527 additions and 127 deletions
|
|
@ -244,6 +244,16 @@ email=root@localhost
|
|||
; Sender email name
|
||||
name="Cockatrice server"
|
||||
|
||||
; Maximum number of attempts to deliver a given e-mail before giving up.
|
||||
; If the smtp server is unreachable or repeatedly rejects a message, the server
|
||||
; will retry with an exponentially growing delay up to this many times, then drop
|
||||
; the message from the queue and log the failure. Default: 5
|
||||
maxretries=5
|
||||
|
||||
; Initial retry delay in seconds between delivery attempts. Doubles with each
|
||||
; failed attempt (capped at 30 minutes). Default: 60
|
||||
retrydelay=60
|
||||
|
||||
; Email subject
|
||||
subject="Cockatrice server account activation token"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue