Kentico CMS has many different ways to handle content notifications in the form of email alerts. You can use the built in notification gateways, various subscription web parts, and/or dynamic newsletters. All of these components offer great solutions to the various scenarios where you want to keep your users up to date on what is going on with the content on your website. Notice the key word I used in that last sustenance, users. I am re-enforcing that point because all of the above mentioned components require that a subscriber be a full user, password and all, in your website.
Having a user who has a full account on the website works perfectly when it comes to an intranet or membership based web site, but doesn’t always work for someone who is just running a blog or basic company website. Sometimes the whole goal of a personal blog or brochure site is to actually capture an anonymous visitor’s email address without that visitor having to go through the hassle of creating a full fledged account. The less steps the better is usually the rule of thumb.
This is the second part of the blog post series that wraps up the whole idea and focuses on the Newsletter portion of the solution. If you did not read the first post of the series, please be sure to read part 1 of Anonymous Blog Post Notifications using Advanced Workflow in Kentico CMS.
The Kentico On-line Marketing Newsletter
Part one of this mini blog post series discussed the fact that Advanced Workflow can handle when to notify your subscribers that there is a new blog post. Part two continues here with a little discussion about the Newsletter system that we are using. Kentico CMS has a great suite of On-line marketing tools, primary among them would we the Newsletter functionality itself. Your Kentico site can have one or many Newsletters, each of them can have their own set of subscribers and own set of templates for how the Newsletter is laid out, and whether or not the delivery payload is an HTML formatted email or plan text formatted email. All of these options are why I choose to use a Newsletter for this solution instead of just a basic email template, even though technically a plain old email template would have worked.
There are other advantages to using a Newsletter for this solution too. First there is a handy Newsletter Subscription web part that can be used out of the box for collecting anonymous email addresses on the public face of the website. More about this later. Second, if you are using Kentico EMS, which I am, you get a ton of additional metrics around successful delivery percentage, who opened the email, what links they clicked, a double opt in system, and full activity tracking for what happens after the subscriber visits the site from being referred by the email. Finally since I am using the Newsletter system I also get an automatic Newsletter Unsubscribe Web Part that handles any anonymous unsubscription requests. All of the without any custom code.
Below is the screen shot of what the basic Newsletter configuration tool looks like. One more thing on Newsletters just in case you have not used them before. Once you define your Newsletter and choose your Template you have the ability to create Issues. You can create as many of them as you would like as often as you like (daily, weekly, monthly, quarterly). All of the Issues use the Template that you choose to layout the content of the email that is sent. Normally the Kentico developer would create the Newsletter Template, and then a content admin would do the work of creating the Issue with it’s specific subject and body content.
After you click the edit icon on the Newsletter you see the details about each of your Issues, Configuration, Subscribers, and the related Templates. The screen shot below shows the results of the Advanced Workflow from part one of this series. I have a blog post about the Ask The Exports 4 session that happened last week. When I clicked publish on the blog post document ,the workflow ran, saw that notifications had not been sent out yet, and generated the Issue you see below with a dynamic subject and fully dynamic content. It pulls the Blog Post Summary field as the Issue content and the Blog Post Title field as the subject of the Issue. It’s pretty darn cool.
The Newsletter Template itself is nothing all that special. The $$content::$$ macro is a special macro that defines the editable zone of the template. The two links below I added to let the user know where the email is coming from and a second link for unsubscription. This second link is again using a special macro that is replaced by the system once each issue is sent out.
Newsletter Subscription Web Part
The Newsletter Subscription Web Part is nothing all that special. It’s a standard web part that comes with the ability to choose which Newsletter that the person will be subscribed to, and lets you control a little bit about the way the form itself is rendered. One small side note, the HTML that is created by this web part is very table based, and it includes some other features for registered users. For my blog I did end up creating a new web part layout to format the form. The web part layout lets me fully control all of the HTML and how it is rendered. My web part layout just shows the subscription text box and subscription subscribe button. You can easy add that through modifying the web part file in visual studio, or using the Layout tab inside of Kentico. The result is shown below.
Again the properties of the Newsletter Subscription web part are configured very standardly and shown below here too:
Plain Old Email Template
This is the only part of the solution that might not make sense at first. I talked about the Newsletter Template as the component that holds the layout of the email that is sent to the subscriber. Well that is only partially true. There is one more step involved here. The Newsletter template holds the majority of the layout and where the various content zones go, but the actual content of the Newsletter Issue is stored in just a plain old Email Template. This is what I’m using to control the body content that is replaced into the Newsletter Issue’s editable content zone. You don’t have to add this layer if you would rather just format the body content in the class file of code from the custom Workflow action, however I think this gives the most flexibility. The screen shot below shows how I have setup the template of the Issue content and where the various blog post fields will be replaced.
Again, this is the template that I have chosen as the parameter value in the Advanced Workflow custom action. Also since I know I am only sending the HTML version of this, I did not bother with the plain text version, you can if you want.
Phew! that’s it on all the various parts of the solution. The write up makes it sound like there is ton to do here, but really it is not that bad. When all said and done, the process runs and I received a nice new email from my blog when I published a blog post.
If there is enough interest I can export out the workflow, custom workflow action, and custom code as one package to make the solution available as download here. Leave a blog post comment below if you are indeed interested. Also let me know if you have solved this problem in another way, because as always this is just one way to solve it.
If you found this valuable you should subscribe to my blog posts to keep up to date on all sorts of Kentico CMS best practices and developer tips.