feat(core): provide the ability to set custom headers on outgoing email messages #24278 #31805
Merged
valentinogiardino merged 19 commits intoApr 5, 2025
Conversation
|
Please use a Conventional Commit title format for this PR. For more information, see https://www.conventionalcommits.org/en/v1.0.0/ |
nollymar
reviewed
Apr 2, 2025
nollymar
reviewed
Apr 2, 2025
nollymar
reviewed
Apr 2, 2025
nollymar
reviewed
Apr 2, 2025
…m-headers-on-outgoing-email-messages
fabrizzio-dotCMS
approved these changes
Apr 3, 2025
…m-headers-on-outgoing-email-messages
nollymar
approved these changes
Apr 4, 2025
…m-headers-on-outgoing-email-messages
spbolton
pushed a commit
that referenced
this pull request
Jun 20, 2025
…il messages #24278 (#31805) ### Proposed Changes - Introduced a new enum, `WorkflowParameter`, in `WorkflowParameter.java` to centralize common workflow actionlet parameters. This enum now defines the `CUSTOM_HEADERS` parameter with its key, description, default value, and requirement status. - Updated various workflow actionlets—such as `EmailActionlet`, `FourEyeApproverActionlet`, `MultipleApproverActionlet`, `NotifyAssigneeActionlet`, `NotifyUsersActionlet`, and `SendFormEmailActionlet`—to utilize the new `WorkflowParameter.CUSTOM_HEADERS`. This change standardizes how custom email headers are defined and extracted. - **MailerTool Update:** Updated the `MailerTool` to support `customHeaders`, ensuring that custom header functionality is available across all email-related tools. - Modified the `Mailer` class to encapsulate header application logic in an `applyHeaders` method. This method now dynamically loads the system-wide default email headers via the new `ConfigUtils.getDefaultEmailHeaders()` method, allowing the default headers configuration to be changed at runtime. - **New Config Property:** Added the `DEFAULT_EMAIL_HEADERS` configuration property. This property allows administrators to define system-wide email header defaults (formatted as a comma-separated list of header key/value pairs, e.g., `"X-Custom-1:Value1, X-Custom-2:Value2"`). When no custom headers are provided at the workflow level, these defaults are applied to all outgoing emails. - Included additional validation and logging to capture and report any header parsing errors or invalid header lines. ### Checklist - [x] Tests - [x] Translations - [x] Security Implications Contemplated (add notes if applicable) ### Additional Info This feature allows users to specify custom headers for workflow-triggered emails, useful for adding metadata or integration purposes (e.g., tracking headers, priority indicators). ### Screenshots #### Notify Assignee  #### Notify user  #### Async Send an Email  #### Send an Email  #### Multiple Approver  #### Four Eyes Approver  #### Send Form email  #### Mailer View Tool  #### Reset Password 
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Introduced a new enum,
WorkflowParameter, inWorkflowParameter.javato centralize common workflow actionlet parameters. This enum now defines theCUSTOM_HEADERSparameter with its key, description, default value, and requirement status.Updated various workflow actionlets—such as
EmailActionlet,FourEyeApproverActionlet,MultipleApproverActionlet,NotifyAssigneeActionlet,NotifyUsersActionlet, andSendFormEmailActionlet—to utilize the newWorkflowParameter.CUSTOM_HEADERS. This change standardizes how custom email headers are defined and extracted.MailerTool Update: Updated the
MailerToolto supportcustomHeaders, ensuring that custom header functionality is available across all email-related tools.Modified the
Mailerclass to encapsulate header application logic in anapplyHeadersmethod. This method now dynamically loads the system-wide default email headers via the newConfigUtils.getDefaultEmailHeaders()method, allowing the default headers configuration to be changed at runtime.New Config Property: Added the
DEFAULT_EMAIL_HEADERSconfiguration property. This property allows administrators to define system-wide email header defaults (formatted as a comma-separated list of header key/value pairs, e.g.,"X-Custom-1:Value1, X-Custom-2:Value2"). When no custom headers are provided at the workflow level, these defaults are applied to all outgoing emails.Included additional validation and logging to capture and report any header parsing errors or invalid header lines.
Checklist
Additional Info
This feature allows users to specify custom headers for workflow-triggered emails, useful for adding metadata or integration purposes (e.g., tracking headers, priority indicators).
Screenshots
Notify Assignee
Notify user
Async Send an Email
Send an Email
Multiple Approver
Four Eyes Approver
Send Form email
Mailer View Tool
Reset Password
This PR fixes: #24278