More in this section
Forums / General Discussions / Email Campaigns and Users

Email Campaigns and Users

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.
3 posts, 0 answered
  1. TIN
    TIN avatar
    1 posts
    13 Jul 2009
    13 Nov 2011
    Link to this post
    How do we send out an email campaign to sitefinity users? I currently have users under the role of customers, separated into 3 types of customers. I would like to send each type of customer a different email campaign. So far, I have only been able to send an email to all users. Is there any way to filter the users in the email campaign. Any feedback would help. Thanks.
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    02 Jan 2018
    16 Nov 2011
    Link to this post
    Hi Tin,

    That's a tough one, the default functionality offers you to pull from a Dynamic list that can be a list of users belonging to any of the User providers, but this will get all users created for that Provider, without the option to filter them by role. However, it's possible to create a new mailing list and fill it with Sitefinity users that belong to a certain role through code. Please find below a code sample I've prepared for you which does exactly this.

    public void CreateMailingListFromUsersInRole(string rolename, string mailingListName, string subject, string reminder, string defaultFromName, string defaultReplyToEmail, bool sendWelcome, bool sendGoodbye)
               var subscribersManager = NewslettersManager.GetManager();
               var roleManager = RoleManager.GetManager();
               //Get the ID of the specified role
               var myroleID = roleManager.GetRole(rolename).Id;
               //Get all users in that Role
               var selectedUsersList = roleManager.GetUsersInRole(myroleID);
               //Create a new Subscribers List and set its properties
               var mailingList = subscribersManager.CreateMailingList();
               mailingList.Title = mailingListName;
               mailingList.DefaultSubject = subject;
               mailingList.SubscriptionReminder = reminder;
               mailingList.DefaultFromName = defaultFromName;
               mailingList.DefaultReplyToEmail = defaultReplyToEmail;
               mailingList.SendGoodByeMessage = sendGoodbye;
               mailingList.SendWelcomeMessage = sendWelcome;
               foreach (var myUser in selectedUsersList)
                   //Get the user DisplayName (Firstname+Lastname)
                   var displayName = UserProfilesHelper.GetUserDisplayName(myUser.Id);
                   //Create a new Subscriber and set his/her properties
                   var subscriber = subscribersManager.CreateSubscriber(true);
                   subscriber.FirstName = displayName.Split(' ').First();
                   subscriber.LastName = displayName.Split(' ').Last();
                   subscriber.Email = myUser.Email;
                   //Add the new Subscriber to the created Mailing List

    You can place the code in a WebForm and create some labels where the properties can be set, and a create button which will execute the code. If there's anything else we can help you, please let us know.

    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Denis
    Denis avatar
    105 posts
    27 Feb 2009
    05 Mar 2013 in reply to Boyan Barnev
    Link to this post

    Trying to avoid recreating mailing list each time (since it is not a dynamic list).

    How about creating new or overriding existing UsersDynamicListProvider?
    This should be more flexible approach. Please let me know if it is possible and throw some code example too. Thanks!

3 posts, 0 answered