Skip to content

MODEMAIL-127 - Extend SMTP configuration to support identities#123

Closed
markusweigelt wants to merge 8 commits into
masterfrom
MODEMAIL-127
Closed

MODEMAIL-127 - Extend SMTP configuration to support identities#123
markusweigelt wants to merge 8 commits into
masterfrom
MODEMAIL-127

Conversation

@markusweigelt

@markusweigelt markusweigelt commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

MODEMAIL-127
- Extend SMTP configuration with identities

Purpose

This PR extends the settings by adding the ability to define itentities. These can then be selected as the sender in various places within the FOLIO frontend, such as via a dropdown menu. This helps reduce incorrect input of the sender address.

In addition, each address can be assigned an optional name, which is used both for display in the frontend selection and for generating the From header, enabling emails to be sent in accordance with the RFC 5322 standard, e.g. "Library Notices" <library-notices@folio.org>.

Approach

  • Schema update with identities array was added alongside the existing from field, each entry has a required address and an optional name
  • Adjusted the behavior for resolving the From address for mail message
  • Duplicate identity addresses are detected at save time and reported, preventing ambiguous lookups during sending
  • Extending tests with the new behaviour

Allow a tenant to register multiple sender identities (address + optional
display name) on one SMTP configuration. When EmailEntity.from matches an
alias, the outgoing From header is rendered per RFC 5322 (`"Name" <addr>`)
if a name is set, else the bare address. Duplicate addresses are rejected.
Include an empty fromAliases array in the SMTP configuration test builders so JsonMatchers.matchesJson (which requires exact field-name equality) aligns with responses that now default the field to an empty array.
@markusweigelt

Copy link
Copy Markdown
Contributor Author

@pfilippov-epam If you are not the right contact person for the review, please let me know.

The SMTP sender list is now called "identities" rather than "fromAliases", with the corresponding generated
POJO renamed from FromAlias to Identity. Pure rename across schema,
service code, validator, and tests.
The 'from' description previously implied a fallback used when no identity
matches, but the code only uses it to backfill EmailEntity.from when the
request omits one. Rewrite both descriptions to match actual behaviour.
@markusweigelt
markusweigelt requested a review from a team May 21, 2026 08:03
@markusweigelt markusweigelt changed the title MODEMAIL-127 - Extend SMTP configuration to support sender address aliases MODEMAIL-127 - Extend SMTP configuration to support identities May 21, 2026

@pfilippov-epam pfilippov-epam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, can I ask you to fix sonarcloud issues and update README.md documentation with example of identifiers usage?

Add identities row to the SMTP configuration parameters table,
extend the email.settings example with a sample identities array,
and explain the From-header matching and fallback behavior.
@markusweigelt

Copy link
Copy Markdown
Contributor Author

Looks good, can I ask you to fix sonarcloud issues and update README.md documentation with example of identifiers usage?

Thx quick review. I’ve fixed the SonarCloud issue and updated the README.md with a suitable example. Do you have any further feedback?

Currently, there is an authentication issue with SonarCloud, which is causing the CI pipeline to fail.

@sonarqubecloud

Copy link
Copy Markdown

@markusweigelt

Copy link
Copy Markdown
Contributor Author

@pfilippov-epam Is it possible for me to merge these changes now with two approvals?

Resolve each BCC address against configured sender identities and set
them on the envelope only, keeping BCC recipients out of the rendered
MimeMessage headers. Accepts a single or comma-separated address list.
@sonarqubecloud

Copy link
Copy Markdown

@markusweigelt

Copy link
Copy Markdown
Contributor Author

Changes are already included in PR #124 and have been merged.

@markusweigelt
markusweigelt deleted the MODEMAIL-127 branch June 19, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants