Repository navigation
Description
Part of #722, Phase 4 step 6. Extends delivery-status notification support from #574; related to recipient results in #723 and capability diagnostics in #733.
Why
A later bounce or delivery-status notification needs to be matched to the particular send that caused it. ENVID supplies an SMTP transaction identifier that a DSN can return as Original-Envelope-ID. It is separate from the MIME Message-ID, and does not alter exact or signed message content.
This neither guarantees a notification or final delivery nor adds a mailbox reader or automatic bounce-processing service.
Approved scope
ENVID only. Recipient-specific NOTIFY and automatic ORCPT are tracked separately in #738, under #722. That follow-up is complete under its own issue through the managed Angus command hook; it is not part of this issue. No upstream Angus release is needed for either implementation.
- By default, generate a fresh UUID for each send on a DSN-capable connection. Reusing or concurrently sending the same Email produces separate identifiers; generated values are never written back onto Email.
- Expose the effective unencoded identifier through
MailSubmissionReceipt.getEnvelopeId(), also available through the observer's receipt. Failed SMTP attempts can retain an identifier actually used for MAIL FROM; its presence does not establish acceptance. Local failures before MAIL FROM report no identifier. Return null when use is absent or unknown. - Let composed and exact Email builders override this with
fixingEnvelopeId(...). Null resumes automatic behavior. Preserve fixed values through partial DSN updates, copying and whole-value Email defaults/overrides. Reusing a fixed value deliberately reuses that identifier. - Validate fixed identifiers before acquiring SMTP resources: non-empty printable ASCII, at most 94 xtext characters for the value (100 including
ENVID=). Do not trim or replace the caller's value. - Check DSN on the actual send connection after TLS/authentication. Automatic generation is best-effort: without usable DSN, send normally without ENVID. A fixed identifier is required: reject before MAIL FROM if unsupported. Existing NOTIFY/RET remain best-effort.
- Use Angus's supported per-message MAIL extension hook. Preserve unrelated raw parameters. Existing raw ENVID suppresses automatic generation and remains caller-owned, without receipt reporting; raw ENVID plus a typed fixed value is rejected.
- Keep identifiers isolated across synchronous/asynchronous, pooled, batch and open-connection sends. Preserve MIME content and receipt/observer ordering.
- Require third-party adapters to opt in to fixed ENVID support and report effective identifiers through
MailTransportResult.withEnvelopeId(...). Older adapters retain ordinary sends without automatic ENVID. CustomMailer receives fixed values on Email and owns transport mapping/enforcement; Simple Java Mail does not generate or report ENVID for that caller-owned transport. Logging-only also reports none. - Expose
--email:fixingEnvelopeIdand--email:fixingExactEnvelopeIdin the CLI. No global property or Spring metadata default is appropriate for a per-send identifier; Spring applications use the same Email API.
Usage
MailSubmissionReceipt receipt = mailer.sync().sendMail(email);
String envelopeId = receipt.getEnvelopeId(); // null when unavailable
// Optional: use an application-owned identifier instead.
emailBuilder.fixingEnvelopeId("order-42-attempt-1");Progress
Complete, accepted and pushed to codex/10.0.0, with the matching website guidance on codex/10.0.0-content. This is unreleased 10.0.0 work. The architecture overview remains accurate: no new worker, lock or resource owner was introduced. Together with #738 this completes the DSN step; the rest of Phase 4 remains open under #722.
Acceptance
- Provider feasibility characterized and the narrower scope approved.
- Automatic and fixed API, validation, copy/governance and serialization coverage.
- Wire encoding, best-effort automatic fallback and strict fixed-ID rejection.
- Pooled concurrency, subsequent sends, shared connections, batches and observer/receipt identity.
- Exact/protected MIME bytes remain unchanged; ambiguous submission retains its identifier without claiming acceptance.
- CLI, classpath/JPMS and provider boundaries covered; configuration/Spring exclusions documented.
- User guidance, migration note, release notes and architecture overview updated.
- Implementation accepted, selectively committed and pushed with matching website documentation.
References: RFC 3461 ENVID, RFC 3464 Original-Envelope-ID, Angus MAIL extension API, Angus 2.0.5 SMTPTransport.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]Add DSN envelope identifiers and original-recipient support[/-][+]Add DSN envelope identifiers for send correlation[/+]docs: explain DSN correlation and shared Email policies
feat(smtp): correlate DSN attempts and recipient notifications (#736, #…
fix(cli): make cold Javadoc cache population thread-safe (#736)
docs(smtp): document accepted DSN and Email policy contracts (#736, #737
bbottema commentedon Sep 17, 2026
Implemented for 10.0.0:
The bundled Angus adapter supplies a fresh identifier for each DSN-capable send. Use
emailBuilder.fixingEnvelopeId("order-42-attempt-1")when you need your own value; fixed identifiers require DSN support. The receipt reports an identifier only when the submission used it, not for a local failure before MAIL FROM.Match it to a later notification's
Original-Envelope-ID; it is separate from Message-ID and does not prove delivery. Usage and sample output.