Container for the parameters to the VerifyEmailAddress operation.

Verifies an email address. This action causes a confirmation email message to be sent to the specified address.

IMPORTANT:The VerifyEmailAddress action is deprecated as of the May 15, 2012 release of Domain Verification. The VerifyEmailIdentity action is now preferred.

This action is throttled at one request per second.

Inheritance: AmazonSimpleEmailServiceRequest
コード例 #1
0
ファイル: VerifyEmail.cs プロジェクト: phonglam29305/FAMail
        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;
        }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SimpleEmail.Model.VerifyEmailAddressRequest();

            if (cmdletContext.EmailAddress != null)
            {
                request.EmailAddress = cmdletContext.EmailAddress;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
コード例 #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the VerifyEmailAddress operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the VerifyEmailAddress operation on AmazonSimpleEmailServiceClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndVerifyEmailAddress
        ///         operation.</returns>
        public IAsyncResult BeginVerifyEmailAddress(VerifyEmailAddressRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new VerifyEmailAddressRequestMarshaller();
            var unmarshaller = VerifyEmailAddressResponseUnmarshaller.Instance;

            return BeginInvoke<VerifyEmailAddressRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
コード例 #4
0
        /// <summary>
        /// Verifies an email address. This action causes a confirmation email message to be sent
        /// to the specified address.
        /// 
        ///  <important> 
        /// <para>
        /// The VerifyEmailAddress action is deprecated as of the May 15, 2012 release of Domain
        /// Verification. The VerifyEmailIdentity action is now preferred.
        /// </para>
        ///  </important> 
        /// <para>
        /// This action is throttled at one request per second.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the VerifyEmailAddress service method.</param>
        /// 
        /// <returns>The response from the VerifyEmailAddress service method, as returned by SimpleEmailService.</returns>
        public VerifyEmailAddressResponse VerifyEmailAddress(VerifyEmailAddressRequest request)
        {
            var marshaller = new VerifyEmailAddressRequestMarshaller();
            var unmarshaller = VerifyEmailAddressResponseUnmarshaller.Instance;

            return Invoke<VerifyEmailAddressRequest,VerifyEmailAddressResponse>(request, marshaller, unmarshaller);
        }
 IAsyncResult invokeVerifyEmailAddress(VerifyEmailAddressRequest verifyEmailAddressRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new VerifyEmailAddressRequestMarshaller().Marshall(verifyEmailAddressRequest);
     var unmarshaller = VerifyEmailAddressResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the VerifyEmailAddress operation.
 /// <seealso cref="Amazon.SimpleEmail.AmazonSimpleEmailService.VerifyEmailAddress"/>
 /// </summary>
 /// 
 /// <param name="verifyEmailAddressRequest">Container for the necessary parameters to execute the VerifyEmailAddress operation on
 ///          AmazonSimpleEmailService.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public IAsyncResult BeginVerifyEmailAddress(VerifyEmailAddressRequest verifyEmailAddressRequest, AsyncCallback callback, object state)
 {
     return invokeVerifyEmailAddress(verifyEmailAddressRequest, callback, state, false);
 }
コード例 #7
0
        IAsyncResult invokeVerifyEmailAddress(VerifyEmailAddressRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new VerifyEmailAddressRequestMarshaller();
            var unmarshaller = VerifyEmailAddressResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
 /// <summary>
 /// <para>Verifies an email address. This action causes a confirmation email message to be sent to the specified address.</para>
 /// <para><b>IMPORTANT:</b>The VerifyEmailAddress action is deprecated as of the May 15, 2012 release of Domain Verification. The
 /// VerifyEmailIdentity action is now preferred.</para>
 /// </summary>
 /// 
 /// <param name="verifyEmailAddressRequest">Container for the necessary parameters to execute the VerifyEmailAddress service method on
 ///          AmazonSimpleEmailService.</param>
 /// 
 public VerifyEmailAddressResponse VerifyEmailAddress(VerifyEmailAddressRequest verifyEmailAddressRequest)
 {
     IAsyncResult asyncResult = invokeVerifyEmailAddress(verifyEmailAddressRequest, null, null, true);
     return EndVerifyEmailAddress(asyncResult);
 }
コード例 #9
0
        /// <summary>
        /// <para>Verifies an email address. This action causes a confirmation email message to be sent to the specified address.</para>
        /// <para><b>IMPORTANT:</b>The VerifyEmailAddress action is deprecated as of the May 15, 2012 release of Domain Verification. The
        /// VerifyEmailIdentity action is now preferred.</para> <para>This action is throttled at one request per second.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the VerifyEmailAddress service method on
        /// AmazonSimpleEmailService.</param>
		public VerifyEmailAddressResponse VerifyEmailAddress(VerifyEmailAddressRequest request)
        {
            var task = VerifyEmailAddressAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
コード例 #10
0
ファイル: SESSamples.cs プロジェクト: rajdotnet/aws-sdk-net
    public static void SESVerifyEmailAddress()
    {
      #region SESVerifyEmailAddress
      var sesClient = new AmazonSimpleEmailServiceClient();

      var request = new VerifyEmailAddressRequest
      {
        EmailAddress = "*****@*****.**"
      };

      sesClient.VerifyEmailAddress(request); 
      #endregion
    }
コード例 #11
0
        /// <summary>
        /// Method to "Verify" a list of email addresses. Every email has to be verified before it is allowed to send email through cloud service.
        /// </summary>
        public void RegisterEmailAddress(List<string> emailAddresses)
        {
            try
            {
                if (emailAddresses == null || emailAddresses.Count == 0)
                    throw new CloudServiceException("Email address must be provided");

                //Create AWS Client
                AmazonSimpleEmailService amazonSes = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(this.cloudServiceConfigProvider.AWSAccessKeyId, this.cloudServiceConfigProvider.AWSSecretKey);

                foreach (string email in emailAddresses)
                {
                    VerifyEmailAddressRequest verifyEmailAddressReq = new VerifyEmailAddressRequest()
                        .WithEmailAddress(email);

                    VerifyEmailAddressResponse verifyEmailAddressRes = amazonSes.VerifyEmailAddress(verifyEmailAddressReq);
                }
            }
            catch (CloudServiceException aex)
            {
                throw aex;
            }
            catch (Exception ex)
            {
                throw new CloudServiceException(ex, "Error occured when trying to verify one of the emails");
            }
        }
コード例 #12
0
        /// <summary>
        /// Initiates the asynchronous execution of the VerifyEmailAddress operation.
        /// <seealso cref="Amazon.SimpleEmail.IAmazonSimpleEmailService.VerifyEmailAddress"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the VerifyEmailAddress operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public async Task<VerifyEmailAddressResponse> VerifyEmailAddressAsync(VerifyEmailAddressRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new VerifyEmailAddressRequestMarshaller();
            var unmarshaller = VerifyEmailAddressResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, VerifyEmailAddressRequest, VerifyEmailAddressResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
コード例 #13
0
  /// <summary>
  /// <para>Verifies an email address. This action causes a confirmation
  /// email message to be sent to the specified address.</para>
  /// </summary>
  /// 
  /// <param name="verifyEmailAddressRequest">Container for the necessary
  ///           parameters to execute the VerifyEmailAddress service method on
  ///           AmazonSimpleEmailService.</param>
  /// 
 public VerifyEmailAddressResponse VerifyEmailAddress(VerifyEmailAddressRequest verifyEmailAddressRequest) 
 {           
     IRequest<VerifyEmailAddressRequest> request = new VerifyEmailAddressRequestMarshaller().Marshall(verifyEmailAddressRequest);
     VerifyEmailAddressResponse response = Invoke<VerifyEmailAddressRequest, VerifyEmailAddressResponse> (request, this.signer, VerifyEmailAddressResponseUnmarshaller.GetInstance());
     return response;
 }
コード例 #14
0
 /// <summary>
 /// Initiates the asynchronous execution of the VerifyEmailAddress operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the VerifyEmailAddress operation on AmazonSimpleEmailServiceClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void VerifyEmailAddressAsync(VerifyEmailAddressRequest request, AmazonServiceCallback<VerifyEmailAddressRequest, VerifyEmailAddressResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new VerifyEmailAddressRequestMarshaller();
     var unmarshaller = VerifyEmailAddressResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<VerifyEmailAddressRequest,VerifyEmailAddressResponse> responseObject 
                     = new AmazonServiceResult<VerifyEmailAddressRequest,VerifyEmailAddressResponse>((VerifyEmailAddressRequest)req, (VerifyEmailAddressResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<VerifyEmailAddressRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
コード例 #15
0
ファイル: VerifyEmail.cs プロジェクト: phonglam29305/FAMail
 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;
 }
コード例 #16
0
        /// <summary>
        /// Initiates the asynchronous execution of the VerifyEmailAddress operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the VerifyEmailAddress operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<VerifyEmailAddressResponse> VerifyEmailAddressAsync(VerifyEmailAddressRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new VerifyEmailAddressRequestMarshaller();
            var unmarshaller = VerifyEmailAddressResponseUnmarshaller.Instance;

            return InvokeAsync<VerifyEmailAddressRequest,VerifyEmailAddressResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
コード例 #17
0
        /// <summary>
        /// Sends a request for email address verification.
        /// </summary>
        /// <param name="emailAddress">Email address to verify</param>
        /// <returns></returns>
        public bool sendEmailVerificationRequest(string emailAddress)
        {
            bool ret = false;
            using (AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(_accessKeyID, _secretAccessKeyID))
            {

                VerifyEmailAddressRequest request = new VerifyEmailAddressRequest();
                request.EmailAddress = emailAddress;
                VerifyEmailAddressResponse response = client.VerifyEmailAddress(request);
                ret = true;
            }

            return ret;

        }
コード例 #18
0
        /// <summary>
        /// <para>Verifies an email address. This action causes a confirmation email message to be sent to the specified address.</para>
        /// <para><b>IMPORTANT:</b>The VerifyEmailAddress action is deprecated as of the May 15, 2012 release of Domain Verification. The
        /// VerifyEmailIdentity action is now preferred.</para> <para>This action is throttled at one request per second.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the VerifyEmailAddress service method on
        /// AmazonSimpleEmailService.</param>
		public VerifyEmailAddressResponse VerifyEmailAddress(VerifyEmailAddressRequest request)
        {
            var task = VerifyEmailAddressAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
コード例 #19
0
        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);
        }
コード例 #20
0
        /// <summary>
        /// Initiates the asynchronous execution of the VerifyEmailAddress operation.
        /// <seealso cref="Amazon.SimpleEmail.IAmazonSimpleEmailService.VerifyEmailAddress"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the VerifyEmailAddress operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public Task<VerifyEmailAddressResponse> VerifyEmailAddressAsync(VerifyEmailAddressRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new VerifyEmailAddressRequestMarshaller();
            var unmarshaller = VerifyEmailAddressResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, VerifyEmailAddressRequest, VerifyEmailAddressResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
コード例 #21
0
 private Amazon.SimpleEmail.Model.VerifyEmailAddressResponse CallAWSServiceOperation(IAmazonSimpleEmailService client, Amazon.SimpleEmail.Model.VerifyEmailAddressRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Email Service (SES)", "VerifyEmailAddress");
     try
     {
         #if DESKTOP
         return(client.VerifyEmailAddress(request));
         #elif CORECLR
         return(client.VerifyEmailAddressAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }