1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / problem on subscribing to newsletters

problem on subscribing to newsletters

10 posts, 0 answered
  1. Roland
    Roland avatar
    45 posts
    Registered:
    23 Feb 2009
    20 Apr 2009
    Link to this post
    Hi,

    I have a couple of questions because I think I have found a problem with regards to subscribers subscribing with news letters.

    I didn't found any table in the database that associates subscriber, group and newsletter together which might impose a problem. There is only an association for "subscriber and group", and "group and newsletter". The problem will happen with the following scenario:

    The user will subscribe to a newsletter which means he will be associated with a group. However what if the group is associated with more than one newsletter then that means that the subscriber will receive other emails from other newsletter aside from the newsletter where he only subscribe.

    Can someone correct me here or is there a solution with it in sitefinity?
  2. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    23 Apr 2009
    Link to this post
    Hi Roland,

    In the Newsletters module there are relations between newsletter/group and group/subscriber.
    When the Subscription form control is used (from the toolbox),  you specify a group the user to be associated with (the user is added to the group, not to the newsletter). This user will then receive information for the newsletters in this group. This gives you more possibilities to design your newsletters (for example you can reuse a newsletter for several groups).

    Solution for you case:  If you want a user to be subscribed to only one Newsletter, just create a group with a single newsletter. Then in the Subscription form control select that group.

    Greetings,
    Parvan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  3. Roland
    Roland avatar
    45 posts
    Registered:
    23 Feb 2009
    23 Apr 2009
    Link to this post
    Hi Parvan,

    I am not sure if you got my point here. I'm not talking about the subscription form because I can create my own subscription form as well. As what you have said there is subscribe/group and group/newsletter. So what if I just want to subscribe to just a single newsletter(not by groups). I just want to subscribe to "NEWSLETTER A" which is associated to "GROUP A". However GROUP A is associated as well with other newsletters aside from NEWSLETTER A, there is NEWSLETTER B blah blah blah. But I just want to subscribe to NEWSLETTER A but because GROUP A is associated as well with other newsletters, I will also receive NEWSLETTER B blah blah blah.
  4. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    30 Apr 2009
    Link to this post
    Hello Roland,

    I understand your point. Yes - if there is GROUP A which have NEWSLETTER A and NEWSLETTER B and you subscribe for GROUP A(note that you subscribe by design only to groups) you will receive both newsletters. 

    I will describe in more details for Groups and Newsletters in Sitefinity.
    The subscriber can be subscribed only to a Group (this is by design). The newsletter is like a single mail - it contains the mail body ,subject. By subscribing to a Group you will receive all newsletters(mails) added to that group. Think for the GROUP A like your newsletter and every added Sitefinity's newsletters (NEWSLETTER A and NEWSLETTER B) like new content(mail) that should be sent to the subscribers of the group.

    I hope this information will be helpful.

    Sincerely yours,
    Parvan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  5. citytech team1
    citytech team1 avatar
    16 posts
    Registered:
    17 Sep 2009
    18 Sep 2009
    Link to this post
    Hi
    According to ouy client's requirements we need to implement newsletter subscription without using the newsletter subscription form.
    Is there any code to override or simply insrt to the relational tables for newsletter subscription so that I canuse them to manage subscription without using subscription control.
    Thanks
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 Sep 2009
    Link to this post
    Hello citytech team1,

    You can create a custom form using Sitefinity's API. You can develop a new user control that will add the users.

    Sample code:

     
     var dManager = new DataManager(); 
     ISubscriber NewSubscriber = dManager.CreateSubscriber("test@test.test"); 
     dManager.SaveSubscriber(NewSubscriber); 
     

    Let us know if there is anything else that we can do for you.

    All the best,
    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.
  7. citytech team1
    citytech team1 avatar
    16 posts
    Registered:
    17 Sep 2009
    18 Sep 2009
    Link to this post
    Hi,
    Thanks for your helpful reply.
    However I need to subscribe an user to an specific group.

    I found there are IGroupSubscriber. I tried to use it using
    IGroupSubscriber newGroupSubscriber = dManager.CreateGroupSubscriberRelation(groupid,subscriberid)
    But I have onlysubscriber email and not the
    groupid and subscriberid.

    The code you posted saves the data to sf_Notify_Subscriber table in DBbut it is not showing from my admin panel.

    Please help. Thanks!
  8. citytech team1
    citytech team1 avatar
    16 posts
    Registered:
    17 Sep 2009
    18 Sep 2009
    Link to this post
    Hi,
    I have got some solution regarding this.
    At first I have fetched the specific group I want to subscribe the new user and then after saving New Subscription I save them using. The code looks something like

    Guid groupID = new Guid("e08674cf-c6df-4043-afaa-750a2c8f894a");
                IGroup grp = dManager.GetGroup(groupID);
                dManager.SaveSubscriber(NewSubscriber);
                IGroupSubscriber english = dManager.CreateGroupSubscriberRelation(groupID, NewSubscriber.SubscriberId);
                dManager.SaveGroupSubscribers(english);


    It would be great if you have any other better solution regarding this.

    Please tell me how I will unsubscribe an userusing my custom code?

    Thanks!
  9. citytech team1
    citytech team1 avatar
    16 posts
    Registered:
    17 Sep 2009
    18 Sep 2009
    Link to this post
    Hi,
    I have some more requirements related to subscription.
    I need to implement Event subscription and News subscription with notification and unsubscription.

    Is there any suport for that in sitefinity?
    If yes, then some custom coding will be great.
    THANKS!
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 Sep 2009
    Link to this post
    Hi citytech team1,

    You can get the GroupID from foreach loop and pass the name if you cannot get easily the Guid which in your case is hardcoded.

       IList listofGroups = dManager.GetGroups("GroupMame ASC"); 
                foreach (IGroup singleG in listofGroups) 
                { 
                    if (singleG.GroupName == "MyGroup"
                    { 
                        Guid grGuid = new Guid(singleG.GroupId.ToString()); 
                        // Do something here 
                       
                    } 
                } 

    The better option is creating a public property of your control to pass the ID. To delete the subscriber you can use  dManager.DeleteSubscriber(NewSubscriber.SubscriberId); method.

    I need to implement Event subscription and News subscription with notification and unsubscription.

    When a user is subscribed or unsubscribed you can use DataMaanger to send an notification.

    Telerik.Notifications.Newsletters.NewsletterManager.SendEmail([toList, body, ssubject, senderName, senderAddress); 

    You can also use System.Web.Mail.MailMessage class.

    Best wishes,
    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.
Register for webinar
10 posts, 0 answered