Skip to content

Conversation

@nicksantamaria
Copy link
Contributor

@nicksantamaria nicksantamaria commented May 9, 2025

Motivation

Currently there are potentially dozens of webforms that are not correctly sending emails when submissions are created due to misconfigurations. This PR aims to fix up any broken webform handler configs using an update hook.

Changes

Adds an update hook which checks every webform email handler and does the following checks:

  • Removes any overridden values for return_path and sender_mail
  • Ensures from_mail uses the site default, or an email explicitly in the SMTP_FROM_WHITELIST environment variable.
  • If from_mail was set to something disallowed, it moved that value to reply_to.

Added actions workflow for phpcs

I don't trust my current knowledge of drupal best practice code standards so added to help me implement correctly.

Fixed code style violations

Sorry this made the PR diff much noisier than it should be.

Related PRs

* - Ensures valid values for from_mail, return_path, and sender_mail fields.
* - Preserves original from_mail in reply_to.
*/
function bay_platform_dependencies_update_10005(&$sandbox) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function is the meat and potatoes of this PR.

@nicksantamaria nicksantamaria marked this pull request as ready for review May 9, 2025 05:06
@nicksantamaria nicksantamaria merged commit fc31d0d into main May 22, 2025
2 checks passed
@nicksantamaria nicksantamaria deleted the feature/webform-email-handler-config-fix branch May 22, 2025 01:29
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.

4 participants