Copied to clipboard

Flag this post as spam?

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


  • Edgar Rasquin 326 posts 925 karma points
    Apr 27, 2023 @ 09:31
    Edgar Rasquin
    0

    Sending from content section

    Hi Markus,

    I have set up the website so that newsletters can be send from the content section. Therefore I placed a line in the web.config as follows:

    <add key="NewsletterStudio:CampaignContentTypes" value="article" />
    

    The Campaign tab shows up and I can create a new campaign. What I don't understand is, what page gets rendered? Can I tell NewsletterStudio what template to use?

    In the previous version I just added "Newsletter" to the "article.cshtml" for it to get used as the newsletter template. So it would be "articleNewsletter.cshtml".

    I tried that but in the campaign list I get an error and I am not shure where to put my breakpoint:

    enter image description here

    Can you help?

    Thanks

  • Markus Johansson 1924 posts 5831 karma points MVP 2x c-trib
    Apr 27, 2023 @ 11:47
    Markus Johansson
    0

    Hi!

    Looks like you've followed the steps outlined here?

    https://www.newsletterstudio.org/documentation/package/3.0.0/develop/sending-from-content-section/

    The new version works in the same way so if you postfix the template name with "Newsletter" we will pick that.

    The screenshot is a bit small so I can't read the error message, do you mind posting some more details about the error you're seeing?

  • Edgar Rasquin 326 posts 925 karma points
    Apr 27, 2023 @ 12:02
    Edgar Rasquin
    0

    Thanks for getting back. It's the standard error message you get for a null reference. Don't know whether it helps much:

    enter image description here

  • Markus Johansson 1924 posts 5831 karma points MVP 2x c-trib
    Apr 27, 2023 @ 12:31
    Markus Johansson
    0

    Hi!

    This might be either because nothing is rendered or because there is some strange HTML on the front end that the HTML-inliner can't handle.

    What happens if you create a template "articleNewsletter" and use that? (Also make sure that the template is created in the backoffice and listed in the "Templates"-list and that the document type article has this template configured as an allowed template.

  • Edgar Rasquin 326 posts 925 karma points
    Apr 28, 2023 @ 13:52
    Edgar Rasquin
    0

    Hi Markus,

    I created a template "articleNews" in the backend. The template is listed in the Templates. I than added it to the allowed templates of the article document type.

    The error remains the same.

    I uninstalled NS and reinstalled V3.0.9 via nuget

    In addition I installed NewsletterStudio.CssInline 1.0.0

    Did not make any difference.

    I added a docType Newsletter. When I create a Campaign from here it works. It finds the Newsletter.cshtml and renders it without any errors.

    Don't know what I am missing...

  • Markus Johansson 1924 posts 5831 karma points MVP 2x c-trib
    May 05, 2023 @ 00:17
    Markus Johansson
    0

    Hi!

    Did you call it "articleNews" or "articleNewsletter"? It has to be postfixed with "Newsletter".

    When you tried with only "Newsletter.cshtml" did you have the exact same content as when you got the error message?

  • Edgar Rasquin 326 posts 925 karma points
    May 05, 2023 @ 08:13
    Edgar Rasquin
    0

    Hi,

    sorry, it is called articleNewsletter.cshtml of course.

    To keep things simple I just used an h1 Tag in the Views:

    <h1>HALLO NEWSLETTER</h1>
    

    This works fine with the Newsletter.cshtml

    Does case sensitivity matter?

    Do I actually need the composer?

    I have created a class in the Folder Composers called newsletterStudioComposer.cs with this in it:

    using Umbraco.Core.Composing;
    
    
    namespace myProject.Composers
    {
     public class AppStart : Umbraco.Core.Composing.IUserComposer
    {
        public void Compose(Composition composition)
        {
            NewsletterStudio.Core.Public.NewsletterStudioService.ContentAppDocumentTypeAliases.Add("article");
            NewsletterStudio.Core.Public.NewsletterStudioService.ContentAppDocumentTypeAliases.Add("articleNewsletter");
        }
    }
    }
    

    Just trying everything...

  • Markus Johansson 1924 posts 5831 karma points MVP 2x c-trib
    May 05, 2023 @ 14:31
    Markus Johansson
    0

    Hi!

    I think that the problem is that there was something in the HTML of the first template that the CssInliner could not handle. The error message indicates that it tries to inline the styles but something goes wrong.

    The fact that it worked with a simple template just verifies this.

    I would "start small", re-create the articleNewsletter.cshtml and start with the same content

    <h1>Test</h1>
    

    And then append more and more content while testing that the rendering works, after a while you'll probably find what property/content/element that breaks the CssInliner.

    Do you understand how I mean?

Please Sign in or register to post replies

Write your reply to:

Draft