Sending campaigns

To send a campaign, you must use the NewslattersManager class. It exposes the SendCampaign method and theSendCampaignCompleted event. The following code sends a campaign through the Native API.

public void SendCampaign( Guid campaignId )
{
    bool tooManySubscribers = false;
 
    NewslettersManager manager = NewslettersManager.GetManager();
    manager.SendCampaignCompleted += this.OnSendCampaignCompleted;
    manager.SendCampaign( campaignId, out tooManySubscribers );
 
    if ( tooManySubscribers )
    {
        //implement logic that handles the case,
        //when there are too many subscribers for the selected campaign.
    }
}
 
private void SendCampaignCompleted( object sender, AsyncCompletedEventArgs e )
{
    manager.SendCampaignCompleted -= this.OnSendCampaignCompleted;
 
    //implement logic that should be executed after the campaign is send.
    //e.g. display a "Capaign successfully send!" message.
}

First, you initialize the NewslettersManager. Then, you attach an event handler for the SendCampaignCompleted event. Then, you callSendCampaign to send the campaign. Finally, you check whether the tooManySubscribers parameter is true.

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK