I could not find anything about EXM and CDN urls. I guess it is expected in the scaled environment, the EXM dispatcher would be on its own server witn CDN turned on.
For my CM environment, I added a new processor to the modifyImageLink pipeline that changes the server url to the CDN url via configs.
namespace Client.Project.EmailCampaign.Pipelines.GenerateLink
{
using Sitecore.Diagnostics;
using Sitecore.Modules.EmailCampaign.Core.Pipelines.GenerateLink;
public class GenerateImageCdnLink : GenerateLinkProcessor
{
public override void Process(GenerateLinkPipelineArgs args)
{
Assert.IsNotNull((object)args, "Arguments can't be null");
Assert.IsNotNull((object)args.Url, "Url can't be null");
bool.TryParse(Sitecore.Configuration.Settings.GetSetting("ExmImageCdnEnabled"), out var exmEnabled);
var cdnUrl = Sitecore.Configuration.Settings.GetSetting("ExmImageCdnUrl");
if (!exmEnabled)
return;
if (string.IsNullOrEmpty(cdnUrl))
return;
args.Url = args.Url.Replace(args.ServerUrl, cdnUrl);
args.GeneratedUrl = args.Url;
}
}
}
And the config
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<sitecore>
<pipelines>
<modifyImageLink>
<processor type="Client.Project.EmailCampaign.Pipelines.GenerateLink.GenerateImageCdnLink, Client.Project.EmailCampaign"
patch:after="processor[@type='Sitecore.Modules.EmailCampaign.Core.Pipelines.GenerateLink.ImageLink.GenerateImageLink, Sitecore.EmailCampaign']"
resolve="true"/>
</modifyImageLink>
</pipelines>
<settings>
<setting name="ExmImageCdnEnabled" value="true"/>
<setting name="ExmImageCdnUrl" value="https://mysite-test-cdn.azureedge.net"/>
</settings>
</sitecore>
</configuration>