Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • suzyb 474 posts 932 karma points
    Jun 12, 2023 @ 21:38
    suzyb
    0

    Merge fields not being replaced

    I am using Newsletter Studio v3.0.9 on Umbraco 8.18.8 but am having trouble with the merge fields not being replaced.

    Neither Unsubscribe nor Read in Browser Link seem to work, the only one that does is the email one. I thought this was initially due to me using these in the Email.cshtml of my theme however when I add them to the content of my email they do not work there either.

    Does anyone have any idea what the problem could be with this. The site was upgraded from v7 of Umbraco recently so Newsletter Studio was upgraded as well. We have had various issues due to this, could this problem be due to the upgrade as well.

  • Markus Johansson 1924 posts 5831 karma points MVP 2x c-trib
    Jun 13, 2023 @ 07:18
    Markus Johansson
    0

    Hi!

    Can you share some more information, where are you using the merge fields, how does your text look? (The merge field that you expect to be replaced).

  • suzyb 474 posts 932 karma points
    Jun 13, 2023 @ 09:23
    suzyb
    0

    I have re-tested as I realised I had neglected to try sending the email to a mailing list rather than a test send. This seems to work so does the preview not replace the merge fields at all.

    I do have another question if you don't mind. I'd like to get the URL of a media item (site's logo) and include it in the email theme. Is this possible? The code I'm using causes an "Issue with batch processing."

    This is my current code to retrieve the logo (I use the same code as a normal view)

    UmbracoHelper helper = Umbraco.Web.Composing.Current.UmbracoHelper;
    
    Settings settingsNode = helper.ContentSingleAtXPath("/root/settings") as Settings;
    string logoUrl = settingsNode.BrandLogo.Url(mode: Umbraco.Core.Models.PublishedContent.UrlMode.Absolute);
    
  • Markus Johansson 1924 posts 5831 karma points MVP 2x c-trib
    Jun 13, 2023 @ 14:22
    Markus Johansson
    100

    Hi!

    Sorry for the short respons, writing on mobile at CodeGarden.

    You should use the IUmbracoContextFactory in this scenario since we need to get the context from a background thread.

    There is a example in the section IUmbracoContext here https://www.jondjones.com/learn-umbraco-cms/umbraco-8-tutorials/getting-started-with-umbraco-8/the-quirks-of-querying-content-in-umbraco-v8/

    / m

  • suzyb 474 posts 932 karma points
    Jun 13, 2023 @ 14:34
    suzyb
    0

    No worries. Thanks for the help.

Please Sign in or register to post replies

Write your reply to:

Draft