Umbraco: send document as newsletter

In one of my recent projects, the client wanted to be able to send a news-document as a newsletter by clicking on a button similar to publishing the document.

Since I’ve never had a chance to actually modify the backend (other than creating new sections), this was a fun challenge. This is what I did:

To achieve this we have to:

  1. Hook into the Page event in Umbraco
  2. Add a new button to the Save/Publish menu
  3. Only show the button on news documents
  4. Send the current documents header and text as an e-mail
We then need the following references:
  • umbraco.BusinessLogic
  • umbraco.presentation.masterpages
  • umbraco.uicontrols
  • umbraco.cms.businesslogic.web
  • umbraco.BasePages
  • System.Web.UI.WebControls

First off, we create a new class and inherit from the ApplicationBase class found in the umbraco.BusinessLogic namespace. In the class’ constructor we’ll hook up to the Page.Load event, so whenever a Page is loaded in Umbraco, we want to do something.

In the eventhandler we have to get a reference to the page, grab it’s URL and check a few things before proceeding. We want to make sure that: we have a querystring with a node id, we’re in the Content section of Umbraco and last, that we have clicked a news document.

Check querystring, page url and document type

So whenever a Page (in the Umbraco backend) is loaded we check the querystring, the URL and the document/node we just clicked. The ‘currentDoc’ is the document the user has clicked in the backend.

Time to add the send-as-newsletter button!

To add the button we need to get a reference to the TabView control (the control which shows the nodes tabs), then get a reference to the TabView panel inside it. We’ll then loop through the TabPages of the TabView to be able to add the button.

Insert button into Umbraco backend

Finally, we need to add the logic (i’ll leave that one up to you ;-) ) to send the newsletter to all the members which are set to receive newsletters. As you can see, the way I wanted to show a Success/Failure speechbubble in Umbraco is deprecated (it works though!), so if you know of a better way, please let me know.

That’s all! :-)

This entry was posted in ASP.NET, Umbraco CMS and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Posted October 13, 2011 at 8:57 pm | Permalink

    Good writeup, Bo – I’m sure it’ll come in handy some day.

  2. Søren Reinke
    Posted October 14, 2011 at 8:55 am | Permalink

    Very good blogpost, will sure keep it bookmarked.

  3. Posted October 25, 2011 at 7:44 pm | Permalink

    Just one thing… in the foreach how do u find the panel?

  4. Michael Latouche
    Posted November 1, 2011 at 5:00 pm | Permalink

    Nice article, thx!

    As far as the deprecated speechbubble is concerned, I use

    ((BasePage) HttpContext.Current.Handler).ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.success, “Success”, “NewsLetter successfully sent”);



Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

+ four = 12