private void PostActionSendTestEmailsMailchimp(Campaign campaign, find_marketingautomationintegration mailChimpObj, ApiRoot root, string emails, ITracingService tracing) { Apihelper.InitializeClient(mailChimpObj.find_MailChimpIntegration); string[] server = mailChimpObj.find_MailChimpIntegration.Split('-'); List <string> listEmalis = emails.Split(',').ToList(); TestEmails testEmails = new TestEmails(listEmalis); Task t = Task.Run(() => root.PostTestsEmails(testEmails, server[1], campaign.find_mailChimpCampaignID)); t.Wait(); }
public async Task PostTestsEmails(TestEmails testsEmails, string server, string campaignID) { string json = JsonConvert.SerializeObject(testsEmails); StringContent data = new StringContent(json, Encoding.UTF8, "application/json"); using (HttpResponseMessage response = await Apihelper.apiClient.PostAsync($"https://{server}.api.mailchimp.com/3.0/campaigns/{campaignID}/actions/test", data)) { if (response.IsSuccessStatusCode) { } } }