1

We have a requirement to customize the look of the confirmation emails sent by EXM when a user subscribes to a contact list, specifically we need a custom header and footer. I have tried to replace the Layout used on the "Subscription Confirmation" item (of template HTML Message) under the manager root, but the confirmation email happily disregards this change.

Looking through the source with dotPeek I discovered that when the confirmation message is fetched, it does so with the method GetStandardMessage, which eventually calls the GetMessageBody method in the Sitecore.Modules.EmailCampaign.Messages.HtmlMail class. This method builds the wrapper of the entire HTML email in one hard-coded line (including a 4px margin on the body element), and injects the value of the "Body" RTE field into the email. For obvious reasons I don't want to include my custom header and footer in the rich text field.

The documentation has a section on building a custom message template, but does not mention how to override the layout of the built-in notification emails. Since the whole feature of "double opt-in" process seems brand new, I have difficulties finding examples of how to perform the customization I'm looking for.

Any suggestions?

Clarification: This is with the built-in version of EXM that comes with Sitecore 9.0.1

  • Can you please specify the version of Sitecore and/or EXM version you're working with? – Pete Navarra Apr 11 '18 at 15:48
  • 1
    9.0.1. Edited the original message. – JohnL Apr 11 '18 at 15:51
3

Instead of customizing the existing template, you're better off creating your own template and create a message based on that.

Documentation is being written to explain how this is done, but here are the steps:

  1. (Optional) Create a custom message template. See Building a custom message template
  2. Create your custom confirmation message and overwrite the default settings:

In EXM, there are a range of service message that you can use to, for example, send a subscription confirmation.

You can use the default service messages or you can customize or replace them.

All the service messages are stored in the manager root:

manager root service messages

In the

App_Config\Sitecore\EmailExperience\Sitecore.EmailExperience.ContentManagement.config

configuration file, you can:

  • Replace a service message with your own. The path to the message must be relative to the manager root.
  • Remove a service message, if you do not want to send a specific service message. If you, for example, never use the unsubscribe notification, you can remove the value of that setting in the configuration file.

Note: Some of the service messages use custom tokens that you may wish to add to your own custom service messages.

Subscription confirmation

Custom token:

  • $link$ - will be replaced by the confirmation link

Setting name: StandardMessages.SubscriptionConfirmation

Default value: "Service Messages/Self-Service Subscription/Subscription Confirmation"

Subscription notification

Once a contact has subscribed (and confirmed their subscription if that option is selected) using the EXM API, a subscription notification is sent Setting name

No custom tokens.

Setting name: StandardMessages.SubscriptionNotification

Default value: "Service Messages/Self-Service Subscription/Subscription Notification"

Unsubscribe notification

Once a contact has unsubscribed from a list, an unsubscribe notification is sent to the contact. This is only done for contact lists included for the email campaign i.e. a notification is not sent when adding the contact to the global opt-out list.

Custom token:

  • $ListName$ - Will be replaced by the name of the list the contact was subscribed to

Setting name: StandardMessages.UnsubscribeNotification

Default value: "Service Messages/Self-Service Subscription/Unsubscribe Notification"

Dispatch completed

During the email campaign creating process, on the Delivery tab, you have the option to notify a set of email addresses when dispatch has completed. Once dispatch has completed, this service message will be sent to the specified email addresses.

Custom tokens:

  • $message$ - Will be replaced by the name of the email campaign
  • $status$ - The status of the email campaign e.g. completed
  • $sent$ - The number of recipients
  • $failed$ - The number of failed recipients

Setting name: StandardMessages.DispatchCompleted

Default value: "Service Messages/Status Messages/Dispatch Completed"

Triggered notification

Once an automated email campaign is activated or deactivated, a notification will be sent to any email addresses specified in the notification field on the Delivery tab.

Custom tokens:

  • $message$ - Will be replaced by the name of the email campaign
  • $status$ - The status of the email campaign e.g. completed

Setting name: StandardMessages.TriggeredNotification

Default value: "Service Messages/Status Messages/Automated Notification"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.