Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic email registration recipients using variables #4971

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

robinmolen
Copy link
Contributor

@robinmolen robinmolen commented Dec 24, 2024

Closes #4650

Changes

The email registration plugin now allows setting the recipient using form variables. This can be combined with the prefill to dynamically set the recipients of a form.

With this, either the emails field (internally known as to_emails) or the email variable field has to be filled. When both are used, the mailing will favor the variable. If for some reason the variable cannot be used for the mailing (i.e. when the variable doesn't result into a valid email address), then the general emails configuration (to_emails) will be used.

The variable can also be used for the payment status update mailings. For the payment status mailing the payment status email addresses will be used. If these aren't defined, then the variable is used and as last resort the general emails configuration will be used.

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

@robinmolen robinmolen force-pushed the feature/4650-set-submission-email-address-using-url-parameters branch from 82c9584 to 472a4fd Compare December 24, 2024 16:16
@robinmolen
Copy link
Contributor Author

There are two tasks that still have to be done:

  • The auth field in the prefill configuration has to be optional (it looks optional, but throws an error when its not used)
  • Fixing the required/optional styling for the prefill configuration fields (required fields should have a bold label, and optional fields should not)

Either the `to_emails` or the `to_email_from_variable` fields should used when registering the email backend plugin.

When a variable is selected, the resulting email address will be used for mailings. When the variable doesn't contain an email address, the `to_emails` will be used as fallback.
The variable chosen in the email registration (`to_email_from_variable`) will now actually be used for the mailing. `to_emails` is used as fallback, in case that the variable doesn't return a valid email address.

The variable will also be used for the payment status update mailing. If `payment_emails` is defined, these will be used as recipients. Otherwise it will use `to_email_from_variable`, and as a last resort the `to_emails`
@robinmolen robinmolen force-pushed the feature/4650-set-submission-email-address-using-url-parameters branch from 472a4fd to 575b635 Compare December 24, 2024 16:26
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.62%. Comparing base (b0b5055) to head (6d96cbc).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4971   +/-   ##
=======================================
  Coverage   96.62%   96.62%           
=======================================
  Files         760      760           
  Lines       25838    25861   +23     
  Branches     3386     3391    +5     
=======================================
+ Hits        24965    24988   +23     
  Misses        608      608           
  Partials      265      265           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Allow form URL-parameter to safely influence to which email address a submission is sent to
1 participant