Having multiple email channels within a single Xperience by Kentico application provides flexibility in how you communicate with your audiences. You can use different sending domains for each channel, which makes it easier to tailor communication to specific regions, brands, or customer segments. Multiple channels also let you distribute different language variants of emails, which a single channel doesn't support.
This page provides best practices for organizing the code of multiple email channels within one Xperience project.
The required level of code separation depends on the content model each channel uses. In most cases, you’ll want to treat them as independent, with separate content types and Email Builder components for each channel. However, if your email channels share an identical content model, you can often treat them as a single channel and reuse your code without any issues.
To implement multiple email channels:
Use a unique namespace in the code name of content types related to a specific email channel. This prevents conflicts when implementing various features related to content types.
For smaller projects, you may store your generated email model classes directly in the main Xperience project.
For larger solutions, where Email Builder components may be placed in dedicated Razor class libraries (opens in a new tab) (RCLs), the model classes must also be available to those RCLs. In this case, we recommend storing your generated email classes in a dedicated Class library project for all generated model classes and reference it from the main Xperience project as well as from any Email Builder RCLs.
Use Razor class libraries (opens in a new tab) (RCLs) to organize the code of your Email Builder components if you plan to create a large number of Email Builder components. For smaller projects you can store your components directly within the main Xperience project. Your components can be shared depending on your implementation.
We recommend structuring your solution with separate projects for each channel, as well as an optional shared library for components shared across your channels:
AllowedWidgets and AllowedSections properties of the EditableArea razor component used to define editable areas in email templates.ContentTypeNames parameter of the registration attribute.