Skip to content

withAddress(@NotNull String oneOrMoreAddresses) is misleading #702

Closed

Description

@sysmat
  • ver 9.3.0
  • oneOrMoreAddresses accept only string but name is misleading; is there delimiter to have multiple
  • why is there no method .to(String oneOrMoreAddresses )?

Activity

  1. bbottema commented on Aug 14, 2026

    @bbottema
    Owner

    Thanks for reporting this, @sysmat. You're right that RecipientBuilder.withAddress(String oneOrMoreAddresses) is misleading: a RecipientBuilder builds one recipient, and this method accepts one address. I'll patch the implementation's parameter and validation name to address.

    The missing .to(...) overload is intentional since 9.0.0: recipients are now constructed explicitly with RecipientBuilder / RecipientsBuilder and added through withRecipients(...), so each recipient carries its TO, CC, or BCC type. The migration guide mentions that change, but the single-address versus delimited-list distinction is not prominent enough. I'll improve the website examples accordingly.

  2. added this to the 9.3.2 milestone on Aug 14, 2026
  3. bbottema commented on Aug 14, 2026

    @bbottema
    Owner

    Released in 9.3.2. I updated RecipientBuilder's implementation parameter and validation label to address, and I clarified the API usage examples and 9.0 migration guide for the one-recipient and delimited-list cases. Thanks again for the report.

  4. sysmat commented on Aug 14, 2026

    @sysmat
    Author

    I like previous API surface much more

  5. bbottema commented on Aug 14, 2026

    @bbottema
    Owner

    I get it, I feel the same, but it was becoming unmaintainable. More and more options (last time S/MIME certs per recipient) resulted in another explosion of overloads and that three times, for the TO, CC and BCC convenience methods, on top of the more generic ones.

    Something had to give. So I just followed through on the fluent builder api that was already part of the library's DNA, in the EmailBuilder and MailerBuilder api's. And now the RecipientBuilder and RecipientsBuilder.

    Now, if there ever are new recipient specific things we want to add, it's just a matter of adding a single field to the builders.

  6. sysmat commented on Aug 14, 2026

    @sysmat
    Author

    I understand to lower a surface area of API

  7. bbottema commented on Aug 18, 2026

    @bbottema
    Owner

    A small follow-up for you and anyone finding this later: you made a fair point and it's was something that kept bugging me as well. In 10.0.0, the compact API is making a small comeback in #705 with the three conveniences people use most:

    RecipientBuilder.to(name, address)
    RecipientBuilder.cc(name, address)
    RecipientBuilder.bcc(name, address)

    This strikes a better balance. The common name-and-address case reads nicely again, while advanced cases still use the full RecipientBuilder. That leaves room for recipient-specific options without bringing back every old overload.

  8. sysmat commented on Aug 19, 2026

    @sysmat
    Author

    @bbottema I was thinking the same way, great news

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