feat(schemas): add new email templates table #7002
Open
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.
Summary
In the previous implementation, we only supported one copy of the email templates configured under the email connector's settings. This becomes a limitation for some of our customers who require i18n support for their email templates. Users from different regions may receive emails in different languages, just like our SIE i18n phrases. We need to support i18n templates to meet the requirements
In addition to the current default email templates stored in connector configs, we need to add an extra global setting to allow users to configure multiple email templates for different languages. This PR introduces the new
email_templates
table.This table will be used to globally maintain custom email templates with i18n support for developers. We will detect the user's language preference and locate the corresponding email template using the following priority:
Accept-Language: en-US
)Accept-Language
header (e.g. Management API triggered email sending flow), use thelocale
value stored in the user's profile data.locale
value, use the default language in SIE.Note
These new i18n email templates will be used globally regardless of the email connector.
We use a shared schema type to define all the email template details. The connector-level template key mapping logic is needed based on different email connectors' interface definitions.
The following email connectors do not support custom email templates. i18n and template customization will be managed by the email provider:
Testing
N/A
Checklist
.changeset
unit testsintegration tests