-
-
Save shahriarhossain/3f0076fb7a16d1672fae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MailChimpCampaigns campaign = new MailChimpCampaigns(); | |
Recipients recipients = new Recipients() | |
{ | |
list_id = "0a84a63afc" //Put your list id | |
}; | |
Settings campaignSettings = new Settings() | |
{ | |
subject_line = "Write down your subject line ", | |
title = "We are Ready !!!!", | |
from_name = "Shahriar Hossain", | |
reply_to = "shossain@desme.com", | |
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) | |
{ | |
///Upload email template | |
ContentSetting cSetting = new ContentSetting(); | |
string path = @"file_directory\fileName_with_extension"; | |
FileParser parser = new FileParser(); | |
cSetting.html = parser.EmailParser(path); | |
var setContentStatus = campaign.SetCampaignContentAsync(campaignCreationResult.Result.id, cSetting).Result; | |
///Alternatively you can Set template as well | |
//ContentTemplate template = new ContentTemplate() | |
//{ | |
// id = "18073" //Put your template id that you want to use | |
//}; | |
//var setContentStatus = campaign.SetCampaignContentAsync(campaignCreationResult.Result.id, 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"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment