More in this section
Forums / Developing with Sitefinity / Create a Newsletter programatically

Create a Newsletter programatically

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Carlos Souto
    Carlos Souto avatar
    6 posts
    09 Jul 2009
    16 Nov 2009
    Link to this post
    Hello guys!

    What is the correct way to create and send a newsletter programatically?

    As there is no (explicit) Newsletter API documentation, i am trying with code blocks i found in the Telerik foruns, like this:

                DataManager manager = new DataManager();
                IGroup advisoryGroup = manager.GetGroup(new Guid("6fdd6de5-4f0f-4836-9421-de91db1f4aa4"));

                int count = advisoryGroup.Subscribers.Count;
                List<string> subscribers = new List<string>();

                for (int i = 0; i < count; i++)

                //Create the Newsletter content:
                //INewsletter news = manager.CreateNewsletter(); // <- First non successful attempt
                Telerik.Notifications.Data.Newsletter news = new Telerik.Notifications.Data.Newsletter();
                //news.Groups = ;
                news.Content = "body of newsletter";
                news.DateCreated = DateTime.Now;
                news.Subject = "Advisory Manager";            
                //Send the new newsletter to subscribers:

                NewsletterManager.SendEmailAsync(subscribers.ToArray(), news.Content, news.Subject, news.SenderName, news.SenderMail);

    Also, could you please let me know if is there any way to attach a file to the newsletter or wich object am i supposed to extend to allw for this feature.

    Best Regards

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    16 Nov 2009
    Link to this post
    Hello Carlos Souto,

    You can use NewsletterManager.SendEmail method. You could also try to use SendEmailsWithDBUpdaingAsync method.

    DataManager dm = new DataManager();
        IList subscribers = dm.GetSubscribers();
        foreach (Telerik.Newsletters.ISubscriber subscriber in subscribers)
            string[] toList = new string[] { subscriber.Email };
            string body = "SOME BODY HERE";
            string subject = "SUBJECT";
            string senderName = "SENDER NAME";
            string senderAddress = "SENDER ADDRESS";
            NewsletterManager.SendEmail(toList, body, subject, senderName, senderAddress);

    Unfortunately the current implementation does not support using attachments. The easiest way for using attachments will be using MailMessage ASP.NET class

    MailMessage msgMail = new MailMessage();

    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered