public async Task <PostmarkResponse> SendEmailWithTemplateAsync <T>(long templateId, T templateModel, string to, string from, bool?inlineCss = null, string cc = null, string bcc = null, string replyTo = null, bool?trackOpens = null, IDictionary <string, string> headers = null, params PostmarkMessageAttachment[] attachments) { var email = new TemplatedPostmarkMessage(); email.TemplateId = templateId; email.TemplateModel = templateModel; email.To = to; email.From = from; if (inlineCss.HasValue) { email.InlineCss = inlineCss.Value; } email.Cc = cc; email.Bcc = bcc; if (trackOpens.HasValue) { email.TrackOpens = trackOpens.Value; } email.ReplyTo = replyTo; if (headers != null) { email.Headers = new HeaderCollection(headers); } if (attachments != null) { email.Attachments = attachments; } return(await SendEmailWithTemplateAsync(email)); }
/// <summary> /// Send an email using a template associated with your Server. /// </summary> /// <param name="message"></param> /// <returns></returns> public PostmarkResponse SendMessage(TemplatedPostmarkMessage message) { var request = NewTemplatedEmailRequest(); request.Entity = message; return(GetPostmarkResponse(request)); }
/// <summary> /// Send an email using a template associated with your Server. /// </summary> /// <param name="message"></param> /// <returns></returns> public IAsyncResult BeginSendMessage(TemplatedPostmarkMessage message) { var request = NewTemplatedEmailRequest(); request.Entity = message; return(BeginGetPostmarkResponse(request)); }
private async Task <PostmarkResponse> InternalSendEmailWithTemplateAsync <T>(object templateReference, T templateModel, string to, string from, bool?inlineCss = null, string cc = null, string bcc = null, string replyTo = null, bool?trackOpens = null, IDictionary <string, string> headers = null, IDictionary <string, string> metadata = null, params PostmarkMessageAttachment[] attachments) { var email = new TemplatedPostmarkMessage(); if (templateReference is long) { email.TemplateId = (long)templateReference; } else { email.TemplateAlias = (string)templateReference; } email.TemplateModel = templateModel; email.To = to; email.From = from; if (inlineCss.HasValue) { email.InlineCss = inlineCss.Value; } email.Cc = cc; email.Bcc = bcc; if (trackOpens.HasValue) { email.TrackOpens = trackOpens.Value; } email.ReplyTo = replyTo; if (headers != null) { email.Headers = new HeaderCollection(headers); } email.Metadata = metadata; if (attachments != null) { email.Attachments = attachments; } return(await SendEmailWithTemplateAsync(email)); }
public async Task <PostmarkResponse> SendEmailWithTemplateAsync(TemplatedPostmarkMessage emailToSend) { return(await ProcessRequestAsync <TemplatedPostmarkMessage, PostmarkResponse>("/email/withTemplate", HttpMethod.Post, emailToSend)); }
public async Task <PostmarkResponse> SendMessageAsync(TemplatedPostmarkMessage emailToSend) { return(await SendEmailWithTemplateAsync(emailToSend)); }
/// <summary> /// Send an email using a template associated with your Server. /// </summary> /// <param name="message"></param> /// <returns></returns> public PostmarkResponse SendMessage(TemplatedPostmarkMessage message) { var request = NewTemplatedEmailRequest(); request.Entity = message; return GetPostmarkResponse(request); }