本文整理汇总了C#中MailChimpManager.CreateCampaign方法的典型用法代码示例。如果您正苦于以下问题:C# MailChimpManager.CreateCampaign方法的具体用法?C# MailChimpManager.CreateCampaign怎么用?C# MailChimpManager.CreateCampaign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailChimpManager
的用法示例。
在下文中一共展示了MailChimpManager.CreateCampaign方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CampaignCreate_Successful
public void CampaignCreate_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
string listID = lists.Data[1].Id;
CampaignSegmentOptions segmentOptions = new CampaignSegmentOptions();
segmentOptions.Match = "All";
string dateListCreated = lists.Data[1].DateCreated;
segmentOptions.Conditions = new List<CampaignSegmentCriteria>();
segmentOptions.Conditions.Add(new CampaignSegmentCriteria { Field = "date", Operator = "eq", Value = dateListCreated });
CampaignCreateContent content = new CampaignCreateContent();
content.HTML = "<p>Testing</p>";
CampaignCreateOptions options = new CampaignCreateOptions();
options.Title = "Testing";
options.ListId = listID;
options.ToName = "Test Name";
options.FromEmail = "[email protected]";
options.FromName = "Testing Company Name";
options.Subject = "Test Subject";
//Act
Campaign result = mc.CreateCampaign("regular", options, content, segmentOptions, null);
// Assert
Assert.IsNotNull(result);
}
示例2: CreateCampaign
private static void CreateCampaign()
{
// Arrange
MailChimpManager mc = new MailChimpManager("e20533551f21cbc6b07c76e570dc33c4-us11");
//ListResult lists = mc.GetLists();
//string listID = lists.Data[0].Id;
CampaignSegmentOptions segmentOptions = new CampaignSegmentOptions();
segmentOptions.Match = "All";
//string dateListCreated = lists.Data[0].DateCreated;
segmentOptions.Conditions = new List<CampaignSegmentCriteria>();
segmentOptions.Conditions.Add(new CampaignSegmentCriteria { Field = "date", Operator = "eq"});
CampaignCreateContent content = new CampaignCreateContent();
content.HTML = @"
<meta charset='utf-8'>
<title></title>
<table width='600' border='0' align='center' cellpadding='0' cellspacing='0' style='background-color: #f0eeee; padding: 20px;'>
<tbody><tr>
<td>
<table width='600' border='0' align='center' cellpadding='0' cellspacing='0'>
<tbody><tr>
<td style='background-color: #ffa900; padding: 10px 30px;'>
<img src='http://localhost:9780/UploadFile/media/e4ed06c6-5445-412e-8f6a-a434e61bee1b-logo.png'></td>
</tr>
<tr>
<td>
<img src='http://localhost:9780/UploadFile/media/4b5335ba-bf57-41e9-8092-a1c1d774d837-email-banner-old.jpg'></td>
</tr>
<tr>
<td style='padding: 20px 30px; text-align: left; color: #222222; font-family: Arial, Helvetica, sans-serif; font-size: 16px; background-color: #fff;'>
<!-- <p>
<strong>Event Details</strong><br />
<br />
Sun-Sat, November 2-8, 10:30 AM - 3:30 P.M. Brighton Gardens of Washington Township 6800 Paragon Road, Dayton, IL 45459
</p>
<p>Have questions about the event? Please contact us at <strong>888-5555-7777.</strong> We look forward to seeing you there!</p>
<br />
<p>The desme Team</p>-->
<div ng-bind-html='model.Description' class='ng-binding'><p><strong>Dear *|FNAME|*,</strong></p>
<p>Thank you for registering for the Taste of Chicago event at the Brighton Gardens of Washington Township!</p>
<p><strong>Event Details</strong><br>
<br>
Sun-Sat, November 2-8, 10:30 AM - 3:30 P.M. Brighton Gardens of Washington Township 6800 Paragon Road, Dayton, IL 45459</p>
<p>Have questions about the event? Please contact us at <strong>888-5555-7777.</strong> We look forward to seeing you there! </p>
<p><a href='*|OFFERPURL|*/*|ACCESSCODE|*' target='_blank'>Click here for subscribe</a></p>
<p>The desme Team</p>
<p> </p>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>";
CampaignCreateOptions options = new CampaignCreateOptions();
options.Title = "Email template testing...";
options.ListId = "1fe090facf";
options.ToName = "Test Name";
options.FromEmail = "[email protected]";
options.FromName = "Testing Company Name";
options.Subject = "Email template testing";
Campaign result = mc.CreateCampaign("regular", options, content);
}