Skip to content

Provide the ability to enable the DSN(Delivery Status Notification) mechanism #574

Closed

Description

@dmittriy13

Issue

We need to be able to enable DSN(rfc3461) for outgoing emails.

Request

It is necessary to implement the ability to specify notification options and return options for notifications. The library should wrap MimeMessage in SMTPMessage and provide control over notification options and return options. At the transport level, SMTPMessage will be processed correctly by the java-mail library automatically.

Activity

  1. added this to the 8.13.0 milestone on Jul 3, 2026
  2. bbottema commented on Jul 3, 2026

    @bbottema
    Owner

    Implemented on the feature branch.

    Summary:

    • Added a DeliveryStatusNotification API with NotifyOption values SUCCESS, FAILURE, DELAY, NEVER and ReturnOption values FULL_MESSAGE, HEADERS_ONLY.
    • Added builder support through withDeliveryStatusNotification(...), withDeliveryStatusNotificationNotifyOptions(...), and withDeliveryStatusNotificationReturnOption(...).
    • Added string-based notify/return-option methods for CLI and property-file use.
    • Added defaults/overrides support and property/Spring support via:
      • simplejavamail.defaults.delivery.status.notification.notify
      • simplejavamail.defaults.delivery.status.notification.return.option
    • SMTP conversion now primes the Angus SMTPMessage DSN state so the transport emits the configured NOTIFY and RET parameters.

    Usage example:

    Email email = EmailBuilder.startingBlank()
            .from("sender@example.com")
            .to("receiver@example.com")
            .withSubject("DSN example")
            .withPlainText("Hello")
            .withDeliveryStatusNotification(
                    DeliveryStatusNotification.ReturnOption.HEADERS_ONLY,
                    DeliveryStatusNotification.NotifyOption.FAILURE,
                    DeliveryStatusNotification.NotifyOption.DELAY)
            .buildEmail();

    Property-file equivalent:

    simplejavamail.defaults.delivery.status.notification.notify=FAILURE,DELAY
    simplejavamail.defaults.delivery.status.notification.return.option=HEADERS_ONLY
  3. bbottema commented on Jul 8, 2026

    @bbottema
    Owner

    Released in Simple Java Mail v9.0.0, which is now available from Maven Central:

    https://repo1.maven.org/maven2/org/simplejavamail/simple-java-mail/9.0.0/

    Release notes:
    https://github.com/bbottema/simple-java-mail/releases/tag/9.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions