The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
Monthly email newsletters are a common tool for informing customers about your products and services. This information includes the latest product updates, new promotions, new tools and upcoming corporate events. In order to stay informed, many organizations subscribe to competitor’s email newsletters to monitor their announcements and the quality of their marketing materials. These materials are often circulated internally and used for strategic planning.
Sitefinity 4.0 can help by gathering, aggregating and publishing this content to your Intranet. The blog post below describes how Sitefinity 4.0’s Publishing System helps organizations stay informed.
With the release of Sitefinity 4.0 and its brand new publishing system, you have the ability to consume external RSS and Atom feeds as well as mail content using the POP3 protocol. Once consumed, this data can be blended into a Publishing Point (data mashup) and published on your Intranet portal.
Once you aggregate the necessary information, you can choose either to publish this content in your Sitefinity project such as news, blogs, and events or push it directly to Twitter or RSS. The flexibility of the system opens a wide range of possibilities, but there is one specific scenario that can easily allow you to stay on top of your competitors. Importing all your competitors’ newsletters into your corporate intranet and automatically publishing them, so that all your employees can stay up to date with important announcements and trends in your market is something I want to bring with this blog post.
In most cases, these newsletters will be sent to an email account hosted on a server that supports POP3 (Gmail, Yahoo and Microsoft Exchange all do support POP3). Sitefinity 4.0’s Publishing System can be used to pull e-mails from this POP3 email account.
Below are the instructions for setting up a new POP3 import:
Content to include is the content that goes in our Publishing point. As mentioned, it can be content from your Sitefinity website or an external ATOM, RSS or POP3 feed. In order to configure the feed to pull information from POP3 and publish it as news on our website we have to do the following:
Note that there is a warning message in the beginning of the dialog that warns you that “All successfully retrieved mail messages will be deleted from the POP3 server”. Please refer to the documentation of your mail server since this is subject to configuration. For example Gmail allows you to leave a copy of the retrieved messages in your inbox, so that you don’t lose any of your emails. For further information please refer to the Gmail POP3 configuration settings.
Now that the POP3 import is created, we have to configure how this information will appear on our Sitefinity website. In order to configure the publishing of the content just retrieved you have to perform the following steps:
A new screen will appear that controls how the information aggregated in the publishing point will be published.
Once the feed is created, Sitefinity displays a list of all feeds. To run the new “Competitors Newsletters” feed simply click on Actions and press the Run button. Now the Competitors Newsletters feed will retrieve all information from the POP3 pipe and publish it as news.
Note: The retrieval of information is not yet automated, you will still have to click on “Run” every time you want to run your feed. However, this can be easily automated just with a few lines of code [See below].
For this sample we have only created a single pipe that contains information from the POP3 server, but other pipes can easily be created that aggregate to the Publishing point. For more information please look at our Creating a feed article.
Sitefinity has its own scheduling system that allows you to queue tasks that will execute on a specific date and time. To create a task inherit from the Telerik.Sitefinity.Scheduling.ScheduledTask class similar to this:
PipeScheduledTask : ScheduledTask
PublishingManager pubManager = PublishingManager.GetManager();
var point = pubManager.GetPublishingPoints().Where((w) => w.Name ==
"Competitors Newsletters "
In the execute task we get our feed from the publishing system, in our case “Competitors Newsletters”, and execute it. We have to also set the TaskName to reflect your full class name, so that the system can properly instantiate the task from our factory and execute it at a specified point.
In order to schedule your task as early in the application lifecycle as possible, you should handle the Initialized event of our Bootstrapper inside the Application_Start handler of your application. To do that open your Sitefinity Web Application in Visual Studio and create a new Global.asax file that is used to handle application and session-state events in your ASP.NET website. In the Application_Start create a static call to the Telerik.Sitefinity.Abstractions.Bootstrapper and sign up for its Initialized event where you will add the logic for scheduling your custom task similar to this:
sender, EventArgs e)
sender, EventArgs args)
SchedulingManager manager = SchedulingManager.GetManager();
var count = manager.GetTaskData().Where(i => i.Key ==
(count == 0)
PipeScheduledTask newTask =
Key = myKey,
ExecuteTime = DateTime.UtcNow.AddSeconds(10),
It is a good practice to create a key for your task so you can search for it later. The Key property of PipeScheduledTask is string, so you can create any kind of key you want. In this case I am using a string that represents a GUID. Second, you should set the ExecuteTime property of the tasks that determines when this task is going to be executed, note that you have to set all your date and time values in Sitefinity in a UTC format. In this case we will schedule a new automatic update of the feed every hour.
Once you queue the tasks in the manager and commit the transaction Sitefinity will determine when it should execute your tasks. If it finds a task that is not yet executed and its execution time has already passed, it will automatically execute it and delete it. This is useful if your application pool recycles and the task misses its execution time.
However, this will not be enough to make the task recurring. Fixing this requires additional logic in the ExecuteTask method. Once your task is executed invoke the Scheduling manager and queue a new task of the same type like this:
SchedulingManager schedulingManager = SchedulingManager.GetManager();
ExecuteTime = DateTime.UtcNow.AddHours(1)
We are aware that the manual scheduling of a new task is not a best practice here and we will do our best to implement an out of the box scheduling with customizable execution time and some way to monitor the proper execution and status of all tasks.
In order to make the following example you will need to download our latest service pack, Sitefinity 4.0 SP1 that introduces a couple of optimizations and bug fixes.
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.