public async Task <SendTemplatedEmailResponse> SendTemplate(string templatename, string name, string url, List <string> to) { _sendtemplaterequest = new SendTemplatedEmailRequest() { SourceArn = "arn:aws:ses:us-east-1:775734958315:identity/[email protected]", Source = "*****@*****.**", Template = templatename, TemplateData = $"{{ \"username\":\"{name}\", \"urlinfo\": \"{url}\" }}", Destination = new Destination { ToAddresses = to } }; try { _sendtemplateresponse = await _Client.SendTemplatedEmailAsync(_sendtemplaterequest); } catch (Exception ex) { Console.WriteLine($"Data: {ex.Data}"); Console.WriteLine($"Source: {ex.Source}"); Console.WriteLine($"Message: {ex.Message}"); } return(_sendtemplateresponse); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { SendTemplatedEmailResponse response = new SendTemplatedEmailResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("SendTemplatedEmailResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, SendTemplatedEmailResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("MessageId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.MessageId = unmarshaller.Unmarshall(context); continue; } } } return; }
public async Task <SendTemplatedEmailResponse> SendTemplate(string templatename, List <string> to, List <string> cc, List <string> bcc, string from, string jsontempvariables) { _sendtemplaterequest = new SendTemplatedEmailRequest() { Source = from, Template = templatename, TemplateData = jsontempvariables, Destination = new Destination { ToAddresses = to, CcAddresses = cc, BccAddresses = bcc } }; try { _sendtemplateresponse = await _Client.SendTemplatedEmailAsync(_sendtemplaterequest); } catch (Exception ex) { Console.WriteLine($"Data: {ex.Data}"); Console.WriteLine($"Source: {ex.Source}"); Console.WriteLine($"Message: {ex.Message}"); _sendtemplateresponse = new SendTemplatedEmailResponse { HttpStatusCode = System.Net.HttpStatusCode.NoContent, MessageId = ex.Message }; } return(_sendtemplateresponse); }