Try Now
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. Jerry Patel Aug 25, 2017
    There are tons of Google Play Store Alternatives Apps available in the market by Acmarket Apk from this link is the best application Acmarket for PC for Android to download Mod games and hacked Apk files.
  9. nester Sep 01, 2017
    Nice, We move increasingly of our gadgets to the universe of Iot, security is assuming a colossal part in this. One approach to secure yourself is to just utilize a decent modem. Lower cost modems frequently need large portions of the security capacities that are expected to avoid such assaults. It doesn't imply that you have to burn through a large number of dollars per site. HP Helpline Number
  10. Pallavi Singh Sep 17, 2017
    vShare Download is possible on Android and iPhone. vShare Helper works like a bridge between your PC to iPhone.vShare Pro Apk
  11. Jerry Patel Sep 17, 2017
    Do you want to download any Android game or useful app for free?Just install GetApk Market on your phone and enjoy all premium games for free.Here you can download GetApk Market Apk file for free and latest version.If your phone doesn't support Android 4.1 (Ice-Cream Sandwich) then Download Bluestacks App Player on your Windows PC and run GetApk Market App for free.If you don't know where to download Bluestacks latest version then please click here and enjoy.hit on download button to start downloading.
  12. Lisa Sep 20, 2017
    Thanks for posting this info.it is very informative and helpful for me.I wish more writers of this sort of substance would take the time to explore and compose so well.
    Canon Support Number UK

    Leave a comment