/// <summary> /// Create a new Email /// </summary> /// <param name="email"></param> /// <returns>The email as returned from the API</returns> public Email CreateEmail(Email email) { RestRequest request = new RestRequest(Method.POST) { Resource = "/assets/email", RequestFormat = DataFormat.Json }; request.AddBody(email); IRestResponse<Email> response = _client.Execute<Email>(request); return response.Data; }
public void CreateEmailTest() { Email email = new Email() { name = "sample email", emailFooterId = 1, emailHeaderId = 1, encodingId = 1, emailGroupId = 1, subject = "sample", htmlContent = new RawHtmlContent() { type = "RawHtmlContent", html = "<html><head></head><body>test</body></html>" } }; Email returnedEmail = _emailClient.CreateEmail(email); Assert.AreEqual(email.name, returnedEmail.name); }
/// <summary> /// Sending an Email is also known as an Email Deployment /// </summary> /// <param name="contactId"></param> /// <param name="email"></param> /// <returns></returns> public Deployment SendEmailToContact(int contactId, Email email) { Deployment deployment = new Deployment { contactId = contactId, email = email, name = "sample deployment", type = "EmailTestDeployment" }; RestRequest request = new RestRequest(Method.POST) { Resource = "/assets/email/deployment", RequestFormat = DataFormat.Json }; request.AddBody(deployment); IRestResponse<Deployment> response = _client.Execute<Deployment>(request); return response.Data; }
public void SendCustomEmailToAddress() { var contact = new Contact() { id = 1, emailAddress = "*****@*****.**" }; var email = new Email() { name = "sample email", htmlContent = new RawHtmlContent() { html = "<html><head></head><body>test</body></html>", type = "RawHtmlContent" } }; var contacts = new List<Contact>(); contacts.Add(contact); var response = _emailClient.SendCustomEmailToAddress(contacts, email); Assert.IsNotNull(response); }
/// <summary> /// Sending an Email is also known as an Email Deployment /// </summary> /// <param name="contacts"></param> /// <param name="email"></param> /// <returns></returns> public EmailDeployment SendCustomEmailToAddress(List<Contact> contacts, Email email) { EmailInlineDeployment deployment = new EmailInlineDeployment() { contacts = contacts, email = email, name = "sample deployment", type = "EmailInlineDeployment" }; RestRequest request = new RestRequest(Method.POST) { Resource = "/assets/email/deployment", RequestFormat = DataFormat.Json }; request.AddBody(deployment); IRestResponse<EmailDeployment> response = _client.Execute<EmailDeployment>(request); return response.Data; }