More in this section
Blogs RSS feed

How to Display Email Campaign Issues on Sitefinity Pages

by Zheyna Peleva
In this blog post I'm going to show you how to place links to already sent Email campaign issues on your Sitefinity pages. The same approach can be used to link fallback versions of your campaigns, directly in the issue itself.

To achieve this, we need two simple user controls:

  • NewsLettersFront contains a repeater that lists all your issues. Since all Sitefinity newsletters campaigns have internal links, that aren't visible if you're not logged it, you don't have a link for each issue as there used to be in 5.1. This functionality is removed, because of security reasons. What we'll do is render the content of the issue on a Sitefinity page, which will simulate the issue being opened in the browser. The repeater lists anchor items with URLs, leading to some page, concatenated with a queryString, where we pass the id of the issue. As I mentioned, you pass the issue id in the queryString and you're redirected to some page. Then on this page you have the CampaignDetail widget.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewsLettersFront.ascx.cs" Inherits="SitefinityWebApp.NewsLettersFront" %>
<asp:Repeater runat="server" ID="myRep">
        <div class="span11">
            <div class="quotestests">
           <a href='<%# string.Format("nameOfPageForIssues?id={0}", Eval("Id")) %>' ><%#Eval("Name")%></a>
        <br />

namespace SitefinityWebApp
    public partial class NewsLettersFront : System.Web.UI.UserControl
        protected void Page_Load(object sender, EventArgs e)
            var pManager = PageManager.GetManager();
            using (ElevatedModeRegion elevatedModeRegion = new ElevatedModeRegion(pManager))
                NewslettersManager manager = NewslettersManager.GetManager();
                Campaign campaign = manager.GetCampaigns().Where(c => c.Name == "TestCampaign").SingleOrDefault();
                var issues = manager.GetIssues(campaign);
                var render = new InMemoryPageRender();
                myRep.DataSource = issues;

  • CampaignDetail handles the logic for getting the queryString parameter value and using it to retrieve the issue. I'm retrieving the issue by its id with the GetIssue() method of the NewslettersManager. After you have the issue, you get its html, and with ResponseWrite (passing the html) you recreate the issue on the page. This way it looks like you're opening the issue in a new page:
public partial class CampaignDetail : System.Web.UI.UserControl
       protected void Page_Load(object sender, EventArgs e)
           var pManager = PageManager.GetManager();
           NewslettersManager newsletterManager = NewslettersManager.GetManager();
           var render = new InMemoryPageRender();
           var queryStringId = Request.QueryString["id"];
           if (queryStringId != null)
               Campaign issue = newsletterManager.GetIssue(new Guid(queryStringId));
               if (issue != null)
                   var campaignMessageBody = issue.MessageBody;
                   var node = pManager.GetPageNode(campaignMessageBody.Id);
                   var text = render.RenderPage(node, false, isIndexMode: false);
                   var realHtml = HtmlProcessor.ProcessHtml(text);

As mentioned above, you can use this approach to place fallback campaign links directly on the emails, sent to your subscribers.

Hope you find the blog post useful!


Leave a comment
  1. Jen Apr 22, 2013
    Amanda, please make sure that the issue you got is not empty, since this is the markup, which would be rendered by an empty email campaign issue.
  2. Amanda S. Apr 22, 2013
    Hi Jen
    When I check var campaingMessageBodyText = issue.MessageBody.BodyText; I'm able to see the content, so I'm fairly certain it's not blank.
    Maybe I should send in a support ticket for you guys to look at it?

    I think this is a great added functionality. One of the complaints I had head was that there was no 'archive' of the newsletter editions. So this will greatly help us.
  3. Jen Apr 23, 2013
    Hello Amanda!

    I'm glad that you found the blog post useful. As you mentioned already, opening a support ticket, will allow us to investigate this behavior further.
  4. Gawein May 09, 2013

    I am experiencing the same output as Amanda. I also get an empty div. But if I request issue.MessageBody.BodyText I do get the correct html code!
    What does render.RenderPage and HtmlProcessor.ProcessHtml do?
  5. Joshua Mar 22, 2014
    Thank you for sharing this! Just what I’ve been searching for. Great info!
  6. Andrew Mar 22, 2014


  7. Marien Brethouwer Oct 29, 2014

    Hi, Great Post!

    You mention that you could use these online versions as a fallback from within the issue itself. I would like to know how to generate the url in the issue that is being send to the subscribers that links to the specific online version of the issue, could you please tell me how you did this? 

    Many thanks in advance.

  8. FauziUzi Feb 12, 2018
    Thank you very much for sharing this very useful information, I am very happy to have found this information that I have been looking for
    Obat Penurun Gula Darah Tinggi
    Obat Rahang Bengkak
    Obat Syaraf Terjepit
    Obat Kebas Dan Kesemutan
    Obat Lecet Pada Vagina
    Obat Ruam Popok
  9. asdf Feb 21, 2018
  10. liwujoye123 Mar 10, 2018
    Thanks share this information if you are facing any technical problem in Macfee antivirus then Visit here McAfee Technical Support

    Leave a comment