EXM on multilanguage Site URL’s

Email Experience Manager mails are constructed on the dispatch server (usually your CM environment).

Thus the links defined in the mails are also linking to the CM environment. However, Sitecore added the MapHostname processor in the modifyHyperlink pipeline in order to replace those cm-URL’s with the public cd-URL’s.

This config is driven by 2 fields on your Email Manager Root: Base URL and Preview Base URL.

Multilingual Sites

This solution works just fine until you have to deal with a website that has a different URL for different cultures.

  • https://www.mysite.com for English language
  • https://www.monsite.com for French language
  • etc

As these fields are shared, you cannot define a different setting, for the different cultures.


The fix is a bit dirty but rather simple.

Step 1.  Make the fields “Base URL” and “Preview base URL” unshared on the template.

Doing this, will enable you to define different URL’s per culture.


Step 2.  Replace the MapHostName processor

We need to make the maphostname processor take the language into account when mapping the hostnames.

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"  xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore role:require="Standalone or ContentManagement or DedicatedDispatch">
        <processor patch:after="*[@type='Sitecore.Modules.EmailCampaign.Core.Pipelines.GenerateLink.MapHostname, Sitecore.EmailCampaign']"
                   type="Feature.Mail.Pipelines.MapLocalizedHostName, Feature.Mail" resolve="true" />


using Sitecore.Modules.EmailCampaign.Core.Pipelines.GenerateLink;

namespace Feature.Mail.Pipelines
    public class MapLocalizedHostName : GenerateLinkProcessor
        public override void Process(GenerateLinkPipelineArgs args)
            var previewUrl = args.MailMessage.ManagerRoot.Settings.PreviewBaseURL;
            var prodUrl = args.MailMessage.ManagerRoot.Settings.BaseURL;

            args.Url = args.Url.Replace(previewUrl, prodUrl);


Leave a Reply

Your email address will not be published. Required fields are marked *