Repository navigation
Description
Why
An order confirmation may need a delivery notification for the customer, failure notifications for a support copy, and no notifications for an archive copy. One shared Email-level NOTIFY setting cannot express those choices.
If a recipient address changes during onward delivery, a later notification is also more useful when it retains the original envelope address. Automatic ORCPT supplies that metadata without asking applications to configure a second copy of each address.
Part of #722, targeting 10.0.0. #736 remains ENVID-only. The shared DKIM/S/MIME configuration design is tracked separately in #737.
Recipient notification preferences
- Add immutable notification preferences to recipients and the existing recipient/group builders, using documented
DeliveryStatusNotification.NotifyOptionenum values rather than protocol strings. Groups use the established default, fixed, and clear conventions; they produce ordinary recipients, not RFC address groups. Composed and exact Email builders also use typed notification/return choices. Java String overloads are removed; CLI converters preserve the existing text values and aliases without duplicating the Java API. The migration notes cover the released Email String overloads, not intermediate unreleased APIs. - An explicit recipient preference wins over a group default and the resolved Email fallback. Group-fixed preferences replace preferences in that group's output. An Email override changes the fallback, not explicit recipient preferences.
- Replace whole preference sets rather than combining events from different scopes. An absent/cleared preference inherits;
NEVERexplicitly requests no notifications. - Keep RET and ENVID transaction-wide. Mailer message policy continues to use Email defaults/overrides; do not introduce another Mailer-level DSN API.
- Preserve preferences through copying, envelope overrides, exact EML, synchronous/asynchronous sends, simple batches, and open connections.
import org.simplejavamail.api.email.config.DeliveryStatusNotification.NotifyOption;
Recipient customer = new RecipientBuilder()
.withAddress("customer@example.com")
.withType(Message.RecipientType.TO)
.withDeliveryStatusNotificationNotifyOptions(NotifyOption.SUCCESS)
.build();
Recipient archive = new RecipientBuilder()
.withAddress("archive@example.com")
.withType(Message.RecipientType.BCC)
.withDeliveryStatusNotificationNotifyOptions(NotifyOption.NEVER)
.build();
Email email = mail.emailBuilder().startingBlank()
.from("sender@example.com")
.withRecipients(customer, archive)
.withPlainText("Your order confirmation")
.buildEmail();
mailer.sync().sendMail(email);With the managed Angus transport and a DSN-capable server:
RCPT TO:<customer@example.com> NOTIFY=SUCCESS ORCPT=rfc822;customer@example.com
RCPT TO:<archive@example.com> NOTIFY=NEVER ORCPT=rfc822;archive@example.com
Automatic original-recipient metadata
- Add ORCPT when the managed connection supports DSN, independently of whether NOTIFY was configured. Derive it from each actual envelope-recipient occurrence, including BCC and override receivers; preserve duplicate occurrences.
- Use appropriate ASCII/internationalized encoding. Omit optional ORCPT when the address cannot be represented safely or the encoded parameter exceeds 500 bytes; never truncate an address.
- Add command parameters only: no extra SMTP round trips, MIME changes, or new transport lifecycle. Angus keeps ownership of the recipient loop and reply handling.
- Do not expose a public ORCPT override for forwarding/gateway use cases.
Support and failure boundaries
Explicit recipient preferences require the managed Angus path and usable DSN support on the actual connection. Reject unsupported preferences before MAIL FROM, without invalidating an otherwise healthy pooled connection. Keep local envelope-policy validation shared by validation, rehearsal, and sending; negotiated server checks remain send-only.
Caller-owned ordinary Angus Sessions and custom socket factories keep shared Email NOTIFY/RET and ENVID support, but do not gain automatic ORCPT and cannot apply explicit recipient preferences. Third-party adapters must opt in; CustomMailer receives the recipient data and owns its transport mapping.
Existing properties, Spring configuration, and CLI Email options continue to configure the shared Email fallback. Recipient-specific choices use Java builders; there is no new global property or CLI recipient-policy language.
ORCPT and ENVID do not guarantee delivery or a notification. Applications still receive and interpret later DSN messages; submission receipts describe the immediate SMTP attempt.
Progress and acceptance
Complete, accepted and pushed to codex/10.0.0, with matching website documentation on codex/10.0.0-content. These are unreleased 10.0.0 changes. Together with #736 this completes the DSN step, not the remaining Phase 4 capabilities.
- Recipient/group API, immutable metadata, precedence, copying, and exact-envelope support.
- Managed Angus integration, automatic ORCPT, and explicit unsupported-path behavior.
- Regression coverage for wire commands, encoding/bounds, duplicate recipients, pooled concurrency/reuse, failures, batches, open connections, and exact content.
- Public API/configuration documentation updated; shared architecture overview reviewed as unchanged.
- Explicit migration notes for automatic ORCPT on managed DSN connections, its provider-support boundaries, and typed Java notification choices.
- Final production review and acceptance.
- Selective semantic commits and push, release-note issue linkage, and concise usage-focused closure comment.
Local design and review references: ADRs 0001-email-configuration-scopes-and-inheritance and 0002-email-defaults-and-overrides, plus slices 2 and 3 of 03_SMTP_ROBUSTNESS_IMPROVEMENT_PLAN/phase-4-modern-esmtp/06c-homogeneous-email-configuration.md.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
docs: explain DSN correlation and shared Email policies
feat(smtp): correlate DSN attempts and recipient notifications (#736, #…
feat(cli): convert typed DSN options and refresh metadata (#738)
docs(smtp): document accepted DSN and Email policy contracts (#736, #737
bbottema commentedon Sep 17, 2026
Implemented for 10.0.0. Choose delivery notifications with enum values on recipients or recipient groups:
Explicit recipient choices beat the Email fallback and require usable DSN support. Managed Angus also adds ORCPT from each actual envelope recipient when supported, including BCC and override receivers, without changing MIME bytes or adding SMTP round trips.
Java DSN options are typed; existing CLI/property text values remain supported. Examples and provider boundaries. Applications still process later notifications themselves; none of these options guarantees delivery.