About Transactional Emails
Transactional emails are one-to-one emails that contain information completing a transaction or process the recipient has initiated. When a customer performs an action on your website, you notify them about it by sending an email.
Here are a few examples of transactional campaigns:
- User registration
- Password reset
- Order confirmation
- Order shipped
- Order delivered
- OTP email verification
Transactional Emails in Sitecore DXP (Sitecore Send)
For sending emails in Sitecore DXP, we can use one of its products: Sitecore Send.
Sitecore Send is a cloud-based, AI-powered email marketing solution that allows you to target your audience at scale.
There are two options to send transactional emails using Sitecore Send:
- SMTP - a clear and well-known option for sending emails. We will utilize this option in the solution.
- Transactional Campaigns - a new feature from Sitecore Send that provides the ability to use dynamic tokens and design transactional emails directly within Send. More information is available in the documentation.
A comparison between these two options is shown in the table below:
Feature | SMTP | Transactional Campaigns |
---|---|---|
Email Design in Send | No [1] | Yes |
Render Email Yourself | Always | Optional [2] |
HTML-Ready Email Support | Yes | Yes |
Email Body by URL | No | Yes |
Attachments | No | Yes |
Bypass Unsubscribed | Yes [3] | Yes |
Notes:
- [1] - Email design can be done with Mustache. For example, see this article, but you'll still need to render the email HTML elsewhere.
- [2] - In transactional campaigns, you can send an HTML email, specify a URL for your email template, or use an email designed in Send.
- [3] - Bypass Unsubscribed means that even if a subscriber has unsubscribed from transactional campaigns, the email will still be sent. With SMTP, this can be done using the API, while it is included out-of-the-box in the Transactional API.
Overall, you can see that transactional campaigns are a more powerful tool for sending transactional emails, but it is quite new and was not available when we started the implementation.
OrderCloud Integration Point
The best way to integrate OrderCloud to send transactional emails is to use Message Senders.
Message Senders is a feature that helps deliver event-driven notifications to users based on certain key commerce activities.
This definition intersects with the definition of transactional emails, so Message Senders are designed for transactional emails or similar types of notifications.
Currently, there's no built-in integration, but you can use the Custom URL option to configure a custom endpoint (similar to a webhook) to handle events when an email should be sent.
The endpoint can be placed in any custom web service, but we use a middleware-based project from OrderCloud.
Sitecore Send SMTP
To send emails, Send SMTP can be used. Sending the email via SMTP varies by language, but for C#, SmtpClient
is the best way.
Full Architecture
The full architecture looks as follows:
We use Azure Service Bus together with Azure Functions for better message handling, to make the process of sending emails more asynchronous and decoupled.
I discussed this in more detail at the Sitecore User Group Poland and SUG Belarus. Please check the recordings for more details.
And of course, share your thoughts and questions with me.