Copied to clipboard

Flag this post as spam?

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


  • Shawn Calvert 31 posts 192 karma points
    Aug 30, 2018 @ 17:44
    Shawn Calvert
    0

    Send Newsletter Studio emails to addresses in custom member properties

    Hi Markus

    Thank you much for your help so far, I think we about have everything working well, but we hit a bit of a snag.

    Here is the scenario:

    For our mailing lists, we are using Member Groups. The Member Groups are created based on member properties that indicate what newsletters they are subscribed to. Currently, when those newsletters are sent, they are sent to the primary member email address.

    That is all working well. However, they also have an option to setup a custom email address for each newsletter; so we somehow need to use the custom email member property instead of the member default.

    Do you think this is possible? I'm guessing this is where custom data fields would come in, or is there a way to create custom mailing lists from member properties directly?

    thank you

    Shawn

  • Markus Johansson 1622 posts 4552 karma points
    Aug 31, 2018 @ 12:29
    Markus Johansson
    0

    Hi!

    So you want to send to different emails depending on a property on the member? You could create a event handler that changes the email depending on the member property. Please note that the MemberService in Umbraco talks to the database so it might be slow.

    Use the event NewsletterStudio.Services.SendNewsletterService.SendingUnique, this event has both the Newsletter and the MailMassage as parameter and it's called right before the email is sent.

    Documentation: https://www.newsletterstudio.org/help/develop-with-newsletter-studio/events/

    Don't hesitate to reach out if you have any further questions.

  • Shawn Calvert 31 posts 192 karma points
    Sep 19, 2018 @ 15:54
    Shawn Calvert
    0

    Hi Markus,

    thank you for your reply; we are working on this now, and our developer is asking where the code for the event handlers should be placed. We have limited experience with custom development in Umbraco and Newsletter Studio. Does the event handler need to go in a render task, an Umbraco surface controller or in a separate DLL? If it is going into a separate dll, how is that dll registered in the Newsletter Studio pipeline. Is there a sample project showing the code to implement one the Newsletter Studio events?

    thanks again, I'm hoping this really is our last question!

    Shawn

  • Markus Johansson 1622 posts 4552 karma points
    Sep 20, 2018 @ 08:21
    Markus Johansson
    100

    Hi!

    After reading this again and thinking a little bit more about your use case it might be a good idea to implement a custom "SubscriptionProvider" that looks similar to the built in "UmbracoNewSubscriptionProvider", the code for this provider can be found here:

    https://gist.github.com/enkelmedia/db535fdc3dffc2b55b9fbd249f127c27#file-newsletter-studio-members-subscription-provider-L69

    On line 69 we're setting the email for the subscriber, there you could add your own logic to replace the default email value with the value from your custom property based on which group of members that you are sending to.

    Full documentation subscription providers can be found here: https://www.newsletterstudio.org/help/develop-with-newsletter-studio/subscription-providers/

    And an examples here, read the "readme" for instructions on how to add the provider to the newsletterStudio.config-file: https://github.com/enkelmedia/NewsletterStudioContrib/tree/master/Newsletter%20Studio%20V2/NewsletterStudioContrib/SubscriptionProviders

    Regarding how to hook in to events, you need to do this during the startup of the application, you can have a look here for an example:

    https://github.com/enkelmedia/NewsletterStudioContrib/blob/master/Newsletter%20Studio%20V2/NewsletterStudioContrib/Events/EventsExample.cs

  • Shawn Calvert 31 posts 192 karma points
    Sep 24, 2018 @ 17:09
    Shawn Calvert
    0

    Hi Markus,

    Thanks again! Your notes set our developer in the right direction.

    We've been using the package for the past couple of weeks and it's working great. In our case, we create member groups from member properties that imported from an outside source, and then send out various flavors of weekly newsletters containing a digest of new posts from the past week. The posts themselves are added using a multi-node content picker, which allows us to pull thumbnails, titles, snippets, links, etc from existing posts. I wasn't 100% sure that would work coming in, but the ability to send from the content section allows an amazing amount of control over the email templates, and has been very easy for the content editors to pick up. I would definitely highly recommend it!

    Shawn

  • Markus Johansson 1622 posts 4552 karma points
    Sep 25, 2018 @ 10:24
    Markus Johansson
    0

    Hi Shawn!

    Thanks a lot for sharing your solution! Sounds really good! =D

    As always, just let me know if you need any further assistance or have any questions/feedback.

    All the best!

    // Markus

Please Sign in or register to post replies

Write your reply to:

Draft