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

Forums / General Discussions / Unsubscribe from all campaigns

Unsubscribe from all campaigns

2 posts, 0 answered
  1. Corbett
    Corbett avatar
    6 posts
    Registered:
    31 Jan 2012
    14 Mar 2013
    Link to this post
    The unsubscribe widget will selectively remove the subscriber from the mailing list used by the campaign.  How can we create an unsubscribe widget that will remove the user from ALL mailing lists in the system? 
  2. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    14 Mar 2013 in reply to Corbett
    Link to this post
    Hi Corbett,

    I'm using the code below for that purpose. Perhaps it helps.

    Dim NewslettersManager As Telerik.Sitefinity.Modules.Newsletters.NewslettersManager = Telerik.Sitefinity.Modules.Newsletters.NewslettersManager.GetManager()
     
                   ' Check if this user exists as a subscriber, regardless of the mailing lists(s) it is subscribed to.
                   Dim Subscriber As Telerik.Sitefinity.Newsletters.Model.Subscriber = NewslettersManager.Provider.GetSubscribers().Where(Function(s) s.Email = EmailAddress).SingleOrDefault()
     
                   If (Subscriber IsNot Nothing) Then
                       ' Remove the user as a subscriber all together.
                       NewslettersManager.DeleteSubscriber(Subscriber.Id)
                       NewslettersManager.SaveChanges()
                   End If
2 posts, 0 answered