A relay can take minutes to answer the final dot (content filter,
large message, slow link). One deadline over the whole transaction
cut it after the message had been accepted, so the delivery was
retried and sent again.
The connection now moves its deadline as the transaction advances:
setup (dial, greeting, TLS, AUTH, MAIL, RCPT, DATA) has
SMTPRelay.Timeout, 60 s by default; the upload has 60 s plus the size
at 32 KiB/s, at most 10 minutes; the reply to the final dot has
10 minutes (RFC 5321 4.5.3.2.6). go-smtp sets and clears its own
per-command deadlines, so a wrapper clips them to the current phase.
Context cancellation still closes the connection at once. A timeout
in any phase is temporary; after the final dot the error says the
outcome is unknown.
- Name the refused command in the error (MAIL FROM, RCPT TO, DATA) so the queue tells a refused sender from a refused recipient
- Test a refusal of the DATA command itself, SMTPUTF8 for non-ASCII addresses and oldest-first threads
- Issue MAIL, RCPT and DATA one by one so a failure knows which command it answers
- Treat 5.1.1, 5.1.2, 5.1.3, 5.1.6 and 5.1.10 as 'no such mailbox' only in answer to RCPT TO
- A refused sender (5.1.x answering MAIL FROM) or a refusal after DATA keeps the delivery as failed and never strikes members
- Ignore a QUIT error once the relay accepted the message: it caused duplicate deliveries
- Add relay TLS modes: none (default), starttls (required, never downgraded) and implicit tls
- Verify the certificate (system roots, optional CA pool and server name), TLS 1.2 minimum
- Add AUTH PLAIN, refused over a clear connection to a remote relay
- Report a wrong password or a relay that wants authentication as a temporary error, so mail waits instead of failing for good
- Add a configurable EHLO name, validated against line breaks
- Arm the context watcher before EHLO so a silent relay cannot hang a send
- Document delivery semantics, retries and the queue API in the README and OpenAPI
- Add relay.concurrency to the example config
- Test that a relay problem never counts against a member, that the longest-waiting delivery goes first, and the error and limit details
- Show the plain relay error when there is a single batch
- Router.Deliver queues one entry per recipient atomically; posts are accepted once queued
- LMTP answers 451 only when the database fails, never because the relay is down
- Confirmation mail uses the same queue
- Wire the worker into the daemon: relay.concurrency config, wake on enqueue, interrupt on Close
- Make SMTPRelay honour the context deadline and cancellation on a silent relay
- Test restart survival, relay outage with retry, and Close with a hung relay
- Add IsPermanent for SMTP 5xx and PermanentError
- Add IsBadMailbox for enhanced status 5.1.x only, so a misconfigured relay says nothing about recipients
- Cover the default relay batch size
- Cover partial and total relay failure in Router.Send
- Cover stripping of spoofed List-* headers without a base URL
- Cover the end of the confirmation rate-limit window