Copied to clipboard

Flag this post as spam?

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


  • Tomasz Kowalski 135 posts 445 karma points
    Sep 03, 2015 @ 06:48
    Tomasz Kowalski
    1

    Send-out from Content, templates and events

    Hi,

    I have to questions:

    1. Is it possible to send a newsletter from content section with template other than this set up on Properties tab? I'd like to have than node can be visible on frontent with website template, and sent from content with newsletter-template. I know, that I could use "altTemplate" on frontend, but I don't see this as a good solution.

    2. I had a template to newsletter (send-from-content), that takes all subnodes and build a newsletter from them. But I would like to mark "sent nodes" as "sent" (custom property). Is there an event like "OnNewsletterSent", so I could do it then?

    Umbraco 7.2, NS 2.1.0

    Kind regrads

    Thomas

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 03, 2015 @ 11:52
    Markus Johansson
    100

    Hi!

    Thank you for looking at Newsletter Studio!

    1. Yes, you can use another template for the content when you send the campaign. If you front end template is called "TextPage" just create one called "TextPageNewsletter" and Newsletter Studio will use that instead of the one used for the front end. Have a look here: http://support.newsletterstudio.org/customer/portal/articles/1053067-sending-from-the-content-section or at the movie here: http://www.newsletterstudio.org/videos/

    2. Yes, there is a event on the sending-service: NewsletterStudio.Services.SendNewsletterService.Sent

    http://support.newsletterstudio.org/customer/portal/articles/1690043-events

    The newsletter-object that is passed as a parameter contains a property called ContentNodeId where the content node id i stored.

    Cheers!

  • Tomasz Kowalski 135 posts 445 karma points
    Sep 07, 2015 @ 13:34
    Tomasz Kowalski
    0

    Hi Markus!

    And thank you for answer. I used NS before, and I should have remembered this template naming :)

    This is first time I'm using NS in Umbraco 7, and I can't see "Preview" function in "send-out from content", which was in Umbraco 6. Am I missing something? I have "only" three buttons: Send out a test e-mail, Send e-mail right now, and Schedule send out for later.

    Kind regards Thomas

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 09, 2015 @ 19:05
    Markus Johansson
    0

    Hi!

    Thats right! We could not include that in the first releases of the package as it requires some really complicated fiddling with the security for the backoffice user.

    We're working on it and it will be included but I can't say when.

    // m

  • keilo 568 posts 1023 karma points
    Sep 03, 2015 @ 13:24
    keilo
    0

    Is there a quick sample on how to use the event

    NewsletterStudio.Services.SendNewsletterService.Sent 

    a sample code that can place under the App_Code would be very handy to get to learn the new events, and how one can use them.

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 03, 2015 @ 16:15
    Markus Johansson
    0

    Hi!

    Try this:

    NewsletterStudio.Services.SendNewsletterService.Sent +=
    delegate(object sender, NewsletterSentEventArgs args)
    {
        // Get id like this
        int? nodeId = args.Newsletter.ContentNodeId;
    };
    
  • Tomasz Kowalski 135 posts 445 karma points
    Sep 10, 2015 @ 11:17
    Tomasz Kowalski
    0

    Hi Markus,

    First, thank you for support! :)

    I have tested a little Sent event. Is that right, that it is triggered only when newsletter was sent, not when it was sent as "test"?

    Kind regards,

    Thomas

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 11, 2015 @ 17:15
    Markus Johansson
    0

    That's right! I will not trigger on a test-email.

    Cheers!

  • keilo 568 posts 1023 karma points
    Sep 10, 2015 @ 11:30
    keilo
    0

    Hi Thomas

    I have tried adding the send event catch snippet in App_Code folder without success.

    Do you mind sharing the code? Maybe missing reference or the proper approach...

  • Tomasz Kowalski 135 posts 445 karma points
    Sep 10, 2015 @ 11:40
    Tomasz Kowalski
    1

    Something like this works for me:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Umbraco.Core;
    using NewsletterStudio.Infrastucture.Events;
    using Umbraco.Core;
    using NewsletterStudio.Services;
    using Umbraco.Core.Logging;
    
    
    namespace newsletterstudio_events
    {
    
        public class nsEventsAppCode : ApplicationEventHandler
        {
            public nsEventsAppCode()
            {
                SendNewsletterService.Sent += SendNewsletterService_Sent;
            }
    
            void SendNewsletterService_Sent(object sender, NewsletterStudio.Infrastucture.Events.NewsletterSentEventArgs e)
            {
                LogHelper.Debug(this.GetType(), "NS TEST AppCode: nodeid:" + e.Newsletter.ContentNodeId.ToString());
    
            }
        }
    
    }
    

    Kind regards Thomas

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 11, 2015 @ 17:14
    Markus Johansson
    0

    Thanks Thomas! =D

  • keilo 568 posts 1023 karma points
    Sep 10, 2015 @ 12:25
    keilo
    0

    Thank you for sharing the code snippet!

    I was puzzled why the event was not logged in the Tracelog, till realizing;

    instead of LogHelper.Debug() i should be using LogHelper.Info()

    On a related note, if the email is sent from the NS section, how does one get the Draft->mailing list name and id and perhaps rendered body?

    I'm also looking at this from the other likely option, i.e. catching the sent e-mails from NS section, and may be construct a page (node) of e-mails sent so they can be presented on the website in the Mailing List Archive section - for end users to see.

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 11, 2015 @ 17:14
    Markus Johansson
    0

    Hi!

    Both your solutions would probably work =D

    Have a great weekend!

    // m

  • keilo 568 posts 1023 karma points
    Sep 11, 2015 @ 17:25
    keilo
    0

    Hey Markus

    Using the event system, if the emails are sent using the NS section (not the content section), how can we get the e-mail sent (title of email, body of email) ?

    The reason for this is to create a umbraco page, where the sent e-mails can be listed with their rendering (body), for something like Archive View of E-mails Sent.

    If you can share a code snippet on how to go about this that would be very helpfull as I cant locate how to use the events yet.

    cheers!

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 12, 2015 @ 11:08
    Markus Johansson
    0

    Hi!

    I'm sorry but I don't have any snippets but the code that Thomas shared is pritty much what you need. Just remove the logging and use the properties from the newsletter-parameter (e.Newsletter) to save a new content node using the Umbraco API.

    Cheers!

    / m

  • keilo 568 posts 1023 karma points
    Sep 12, 2015 @ 11:38
    keilo
    0

    Hi Markus

    What I meant to ask is if the email ise sent via the NewsletterStudio section (not content section), then how can we retrieve the e-mail reference (like title (subject), body of the email sent.

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 21, 2015 @ 13:03
    Markus Johansson
    0

    The same way as in the example that Thomas posted. Did you try it?

    Cheers!

  • keilo 568 posts 1023 karma points
    Sep 21, 2015 @ 16:08
    keilo
    0

    Hi Markus

    I have managed to get the body and name of the skin at the sentevent;

    e.Newsletter.SkinAlias (like default) e.Newsletter.MessageBody

    But how can I get the full email (i.e. skin with content, full html), so I can create a Content Page with full view?

    Not sure if we are able to get the MIME, do recall a discussion about it sometime ago.

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 21, 2015 @ 16:44
    Markus Johansson
    0

    Hi!

    Good question! You can't really get that since the full content varies for each subscriber. But you would want the whole rendered content for an email on the web any way? Right?

    // m

  • keilo 568 posts 1023 karma points
    Sep 21, 2015 @ 16:47
    keilo
    0

    Hi Markus

    Thats right, kind of like Email Archive page listing where users can click and see the email online.

    If i can get the name of the skin, and the body, is there any way to somehow get the full email to be displayed (like the preview function does, where it uses example as placeholders) ?

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 21, 2015 @ 16:55
    Markus Johansson
    0

    You could always use the API to list the newsletters and then use the build in render preview-page to render the letter in preview mode.

    Use the this repository to get the newsletters: GlobalFactory.Current.NewsletterRepository

    Try following the exsisting preview-links in the backoffice - if you need further assistance with details - please concider either extended support or to hire us to help you out.

    Cheers!

    // m

  • keilo 568 posts 1023 karma points
    Sep 21, 2015 @ 18:12
    keilo
    0

    Hi again Markus

    Is this how we use the GlobalFactory.Current.NewsletterRepository

    var container = new NewsletterStudio.Infrastucture.Data.NewsletterRepository();
    var list = container.GetArchived();
    foreach (var entry in list){
        [email protected]
    }
    

    Is that your advised approach? It would have been great if there was a way to get full MIME of the message. Couldnt find it in the new Events listed.

    On a related note;

    While using the responsive template, the editor can add table/markup but when the email needs to send out the styles needs to be inlined (like in your responsive sample using INK framework), so what would be your advise on the right place/event do to that?

    I thought of reading the Responsive Skin file (IO) and replacing the MessageBody, then sending it to a PreMailer.MoveCssInline(skin-merged-MessageBody)

    but then how can we tell NS to use this merged (css-inlined) body to be used in send out?

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 21, 2015 @ 18:40
    Markus Johansson
    0

    Hi!

    Did you look at Render Tasks? You can use them to process the message body during a send out.

    http://support.newsletterstudio.org/customer/en/portal/articles/1052872-control-content-with-render-tasks

    // m

  • keilo 568 posts 1023 karma points
    Sep 21, 2015 @ 18:53
    keilo
    0

    You are right! The Render Task is the right place to do cssinlining, i was carried away thinking along the lines of getting access to full mime (for spam-scoring, listing etc.).

    Back on the topic, if I list all the items in the Archived, how do I sort them by creationdate descending?

    var container = new NewsletterStudio.Infrastucture.Data.NewsletterRepository();
    var list = container.GetArchived();
    foreach (var entry in list){
        [email protected]
    }
    
  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Sep 21, 2015 @ 18:57
    Markus Johansson
    0

    Hi!

    It's just a list collection - please se the offical C#-documentation on how to sort lists.

    https://msdn.microsoft.com/en-us/library/b0zbh7b6(v=vs.110).aspx

    // m

Please Sign in or register to post replies

Write your reply to:

Draft