-
Notifications
You must be signed in to change notification settings - Fork 16
Campaign Creation Tutorial
Shahriar Hossain edited this page Dec 10, 2015
·
3 revisions
Following code demonstrate how you can Create a campaign with existing template and send mail to its subscriber
MailChimpCampaigns campaign = new MailChimpCampaigns();
Recipients recipients = new Recipients()
{
list_id = "0a84a63afc" //Put your list id
};
Settings campaignSettings = new Settings()
{
subject_line = "Ready For action ",
title = "We are Ready !!!!",
from_name = "Shahriar Hossain",
reply_to = "[email protected]",
template_id = 18073, //Put your template id that you want to use
authenticate = true,
auto_footer = false
};
Tracking campaignTracking = new Tracking()
{
opens = true,
html_clicks = true,
text_clicks = true
};
ResultWrapper<Campaign> campaignCreationResult = campaign.CreateCampaignAsync(CampaignType.regular, recipients, campaignSettings, campaignTracking).Result;
if (campaignCreationResult.HasError == false)
{
ContentTemplate template = new ContentTemplate()
{
id = "18073" //Put your template id that you want to use
};
ContentSetting cSetting = new ContentSetting();
var setContentStatus = campaign.SetCampaignContentAsync(campaignCreationResult.Result.id, cSetting, template).Result;
var checkListResult = campaign.GetCampaignContentAsync(campaignCreationResult.Result.id).Result;
if (checkListResult.is_ready)
{
var sendStatus = campaign.SendCampaignAsync(campaignCreationResult.Result.id).Result;
}
}
else
{
String.Format("Best of Luck! I can't handle :p");
}