• Not Answered

Sitecore EXM broken link in the mail message

I've created "Simple HTML message" and added some internal links in the Message body using rich text editor

In html it look like this: <a href="~/link.aspx?_id=D16025CAB7D049FDAC6863C29C13F0C1&amp;_z=z">TEST</a>

When I sending test message this link is converted to: http://mydomain.com/://mydomain.com/TEST

This link is broken, redundant part - ://mydomain.com/

How I can fix it?

9 Replies

  • In reply to DHEER RAJPOOT:

    http://mydomain.com

    but this value does not affect to the generated link. I can change it on standard value http://your.host and as a result in the mail I see:  http://mydomain.com/://mydomain.com/TEST

  • From a glance that looks like an issue with the link provider. Do you happen to have a custom implementation in place or using a LinkProvider module?

    Greetz,
    Markus

  • In reply to Markus Klimmasch:

    No, LinkProvider is standard

    Also if I open EXM Iframe with message in the new tab(.../sitecore%20modules/shell/EmailCampaign/UI/Dialogs/MessageBody.aspx?message=...) all links are correct and look like this: http://mydomain.com/sitecore/RedirectUrlPage.aspx?ec_eq=...

    but in the mail I see other links

  • In reply to Markus Klimmasch:

    Maybe it will be useful information too:

    LinkManager.config:

    <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" lowercaseUrls="false" shortenUrls="true" useDisplayName="true" siteResolving="true" patch:source="LinkManager.config"/>

     

    Sites.config:

    <site name="Website3" targetHostName="site1.mydomain.com" hostName="site1.mydomain.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/site1.mydomain.com" startItem="/home" language="en" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" patch:source="Sites.config"/>
    <site name="Website2" targetHostName="site2.mydomain.com" hostName="site2.mydomain.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/site2.mydomain.com" startItem="/home" language="en" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" patch:source="Sites.config"/>
    <site name="Website1" targetHostName="mydomain.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/www.mydomain.com" startItem="/home" language="en" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" patch:source="Sites.config"/>
  • In reply to Markus Klimmasch:

    I found place with issue

    It HandleInternalLink processor

    this line return absolute path  

    args.Url = LinkManager.GetItemUrl(new ItemUtilExt().GetItem(result.ItemId), defaultUrlOptions);

    despite the fact that defaultUrlOptions.AlwaysIncludeServerUrl = false;

    For testing I copied this code in rendering which placed on the home page and result was correct relative path instead absolute

    Any ideas how I can fix it in the HandleInternalLink processor?

  • In reply to John Snow:

    Hi John,


    you can simply replace the processor with your own implementation.

    Note the version I checked does not have this line of code (3.1.2 rev. 151213). Which version are you using? Looks like this has been fixed in the meantime...


    Greetz,
    Markus
  • In reply to Markus Klimmasch:

    Email Experience Manager 3.3.0 rev. 160527

    It's look like a bug for multisite Sitecore environments. For generating url is called standard Sitecore method LinkManager.GetItemUrl, but EXM sends messages not in the main thread and do not have access to HttpContext, so property AlwaysIncludeServerUrl = false doesn't work and url always return server part from targetHostName in site definitions.

    As a result I've overridden HandleInternalLink pipeline)

  • In reply to John Snow:

    I am also having the same issue with entering the correct value for the "Base URL". When I create links in the email message, I use the "Insert Sitecore Link" tool to select the page on our website (https://www.stoutadvisory.com). However, when sending a draft of the email and the actual send, the links are going to the CM server instead of the CD Server.