/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { VerifyEmailAddressResponse response = new VerifyEmailAddressResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if(context.TestExpression("VerifyEmailAddressResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return response; }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { VerifyEmailAddressResponse response = new VerifyEmailAddressResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return response; }
private static void UnmarshallResult(XmlUnmarshallerContext context, VerifyEmailAddressResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) targetDepth += 2; while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { } } return; }
public bool VerifyEmailAddress(string email) { bool result = false; VerifyEmailAddressRequest request = new VerifyEmailAddressRequest(); VerifyEmailAddressResponse response = new VerifyEmailAddressResponse(); if (client != null) { request.EmailAddress = email.Trim(); response = client.VerifyEmailAddress(request); if (!string.IsNullOrEmpty(response.ResponseMetadata.RequestId)) { result = true; } } return result; }
public bool VerifyEmailAddress(string email) { bool result = false; client = new AmazonSimpleEmailServiceClient(AccessKey, SecretKey); List<String> verifiedEmailAddresses = ListVerifiedEmailAddresses(); VerifyEmailAddressRequest request = new VerifyEmailAddressRequest(); VerifyEmailAddressResponse response = new VerifyEmailAddressResponse(); if (IsValidMail(email) == true) { if (!verifiedEmailAddresses.Contains(email)) { if (client != null) { request.EmailAddress = email.Trim(); response = client.VerifyEmailAddress(request); if (!string.IsNullOrEmpty(response.ResponseMetadata.RequestId)) { result = true; } } } } return result; }
public static bool sendVerificationEmailAmazonSES(string email) { string accesKey = ConfigurationManager.AppSettings["AWSAccessKey"].ToString(); string secretKey = ConfigurationManager.AppSettings["AWSSecretKey"].ToString(); String HOST = "https://" + ConfigurationManager.AppSettings["AWSServer"].ToString(); var region = RegionEndpoint.USWest2; AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig { ServiceURL = HOST, RegionEndpoint = region }; bool result = false; //try { //.GetBySystemName("us-west-2"); Amazon.SimpleEmail.Model.VerifyEmailAddressRequest request = new Amazon.SimpleEmail.Model.VerifyEmailAddressRequest(); Amazon.SimpleEmail.Model.VerifyEmailAddressResponse response = new Amazon.SimpleEmail.Model.VerifyEmailAddressResponse(); Amazon.SimpleEmail.AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(accesKey, secretKey, region); //, amConfig); if (client != null) { request.EmailAddress = email.Trim(); response = client.VerifyEmailAddress(request); if (!string.IsNullOrEmpty(response.ResponseMetadata.RequestId)) { result = true; } } //} //catch (Exception ex) // { // Console.WriteLine(ex.Message); // } return(result); // //INITIALIZE AWS CLIENT// // // AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig(); // // amConfig.UseSecureStringForAwsSecretKey = false; //// amConfig.c // //String HOST = "http://"+ConfigurationManager.AppSettings["AWSServer"].ToString(); // try // { // //AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig { ServiceURL = HOST }; // string HOST = ConfigurationManager.AppSettings["AWSServer"].ToString(); // const int PORT = 587; // // Create an SMTP client with the specified host name and port. // using (AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(accesKey, secretKey)) // { // // Create a network credential with your SMTP user name and password. // client.Credentials = new System.Net.NetworkCredential(accesKey, secretKey); // // Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then // // the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL. // //client.EnableSsl = true; // //AmazonSimpleEmailServiceClient amzClient = new AmazonSimpleEmailServiceClient(accesKey, secretKey); // //ConfigurationManager.AppSettings["AWSAccessKey"].ToString(), // //ConfigurationManager.AppSettings["AWSSecretKey"].ToString(), amConfig); // //VERIFY EMAIL// // VerifyEmailAddressRequest veaRequest = new VerifyEmailAddressRequest(); // veaRequest.EmailAddress = email;// "Your_Email_To_Verify"; // VerifyEmailAddressResponse veaResponse = client.VerifyEmailAddress(veaRequest); // } // // int x = 0; // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // //return false; // } //Response.Write(veaResponse..ResponseMetadata.RequestId); }