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 = "*****@*****.**"; options.FromName = "Testing Company Name"; options.Subject = "Test Subject"; //Act Campaign result = mc.CreateCampaign("regular", options, content, segmentOptions, null); // Assert Assert.IsNotNull(result); }
private static void UpdateCampaign() { // Arrange MailChimpManager mc = new MailChimpManager("e20533551f21cbc6b07c76e570dc33c4-us11"); CampaignFilter filter = new CampaignFilter(); filter.Title = "test123"; var cam = mc.GetCampaigns(filter); CampaignCreateContent content = new CampaignCreateContent(); string 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 to delwar</a></p> <p>The desme Team</p> <p> </p> </div> </td> </tr> </tbody></table> </td> </tr> </tbody></table>"; var result = mc.UpdateCampaign(cam.Data[0].Id, "content", new { html = HTML }); }
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://*****:*****@desme.com"; options.FromName = "Testing Company Name"; options.Subject = "Email template testing"; Campaign result = mc.CreateCampaign("regular", options, content); }
public void SendCampaign() { if ((cmbTemplate.SelectedIndex > 0 && cmbTemplate.SelectedItem != null) && (cmbList.SelectedIndex > 0 && cmbList.SelectedItem != null)) { Int32 selectedTemplateId = Convert.ToInt32(cmbTemplate.SelectedValue); string selectedListId = cmbList.SelectedValue.ToString(); //IEnumerable<string> listEnum = new string[] { selectedListId.ToString() }; //--Create Campaign CampaignSegmentOptions segmentOptions = new CampaignSegmentOptions(); segmentOptions.Match = "All"; CampaignCreateOptions options = new CampaignCreateOptions(); options.Title = mailchimptitle; options.ListId = selectedListId; options.ToName = mailchimpToName; options.FromEmail = mailchimpFromEmail; options.FromName = mailchimpFromName; options.Subject = mailchimpSubject; options.TemplateID = selectedTemplateId; CampaignCreateContent content = new CampaignCreateContent(); Campaign result = mc.CreateCampaign("regular", options, content, null, null); //GetMemberInfo if (chkEnableSMS.Checked) { List<EmailParameter> emails = new List<EmailParameter>(); MembersResult results = mc.GetAllMembersForList(selectedListId, "subscribed", 0, 100); foreach (var i in results.Data) { foreach (var j in i.MemberMergeInfo) { if (j.Key.Trim() == "PHONE") { if (!string.IsNullOrEmpty(j.Value.ToString())) { // SmsSender.SendSMS(j.Value.ToString(), "919460264151", "5b2a23d7", "59d9fa03", Uri.EscapeUriString("Test Message")); } } } } } } MessageBox.Show("Success"); this.Close(); }