Container for the parameters to the SendBounce operation. Generates and sends a bounce message to the sender of an email you received through Amazon SES. You can only use this API on an email up to 24 hours after you receive it.

You cannot use this API to send generic bounces for mail that was not received by Amazon SES.

For information about receiving email through Amazon SES, see the Amazon SES Developer Guide.

This action is throttled at one request per second.

Inheritance: AmazonSimpleEmailServiceRequest
        /// <summary>
        /// Initiates the asynchronous execution of the SendBounce operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendBounce 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<SendBounceResponse> SendBounceAsync(SendBounceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SendBounceRequestMarshaller();
            var unmarshaller = SendBounceResponseUnmarshaller.Instance;

            return InvokeAsync<SendBounceRequest,SendBounceResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// Generates and sends a bounce message to the sender of an email you received through
        /// Amazon SES. You can only use this API on an email up to 24 hours after you receive
        /// it.
        /// 
        ///  <note> 
        /// <para>
        /// You cannot use this API to send generic bounces for mail that was not received by
        /// Amazon SES.
        /// </para>
        ///  </note> 
        /// <para>
        /// For information about receiving email through Amazon SES, see the <a href="http://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email.html">Amazon
        /// SES Developer Guide</a>.
        /// </para>
        ///  
        /// <para>
        /// This action is throttled at one request per second.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SendBounce service method.</param>
        /// 
        /// <returns>The response from the SendBounce service method, as returned by SimpleEmailService.</returns>
        /// <exception cref="Amazon.SimpleEmail.Model.MessageRejectedException">
        /// Indicates that the action failed, and the message could not be sent. Check the error
        /// stack for more information about what caused the error.
        /// </exception>
        public SendBounceResponse SendBounce(SendBounceRequest request)
        {
            var marshaller = new SendBounceRequestMarshaller();
            var unmarshaller = SendBounceResponseUnmarshaller.Instance;

            return Invoke<SendBounceRequest,SendBounceResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the SendBounce operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SendBounce 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 EndSendBounce
        ///         operation.</returns>
        public IAsyncResult BeginSendBounce(SendBounceRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SendBounceRequestMarshaller();
            var unmarshaller = SendBounceResponseUnmarshaller.Instance;

            return BeginInvoke<SendBounceRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 /// <summary>
 /// Initiates the asynchronous execution of the SendBounce operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the SendBounce 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 SendBounceAsync(SendBounceRequest request, AmazonServiceCallback<SendBounceRequest, SendBounceResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new SendBounceRequestMarshaller();
     var unmarshaller = SendBounceResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<SendBounceRequest,SendBounceResponse> responseObject 
                     = new AmazonServiceResult<SendBounceRequest,SendBounceResponse>((SendBounceRequest)req, (SendBounceResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<SendBounceRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
示例#5
0
 private Amazon.SimpleEmail.Model.SendBounceResponse CallAWSServiceOperation(IAmazonSimpleEmailService client, Amazon.SimpleEmail.Model.SendBounceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Email Service (SES)", "SendBounce");
     try
     {
         #if DESKTOP
         return(client.SendBounce(request));
         #elif CORECLR
         return(client.SendBounceAsync(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;
     }
 }
示例#6
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SimpleEmail.Model.SendBounceRequest();

            if (cmdletContext.BouncedRecipientInfoList != null)
            {
                request.BouncedRecipientInfoList = cmdletContext.BouncedRecipientInfoList;
            }
            if (cmdletContext.BounceSender != null)
            {
                request.BounceSender = cmdletContext.BounceSender;
            }
            if (cmdletContext.BounceSenderArn != null)
            {
                request.BounceSenderArn = cmdletContext.BounceSenderArn;
            }
            if (cmdletContext.Explanation != null)
            {
                request.Explanation = cmdletContext.Explanation;
            }

            // populate MessageDsn
            var requestMessageDsnIsNull = true;

            request.MessageDsn = new Amazon.SimpleEmail.Model.MessageDsn();
            System.DateTime?requestMessageDsn_messageDsn_UtcArrivalDate = null;
            if (cmdletContext.MessageDsn_UtcArrivalDate != null)
            {
                requestMessageDsn_messageDsn_UtcArrivalDate = cmdletContext.MessageDsn_UtcArrivalDate.Value;
            }
            if (requestMessageDsn_messageDsn_UtcArrivalDate != null)
            {
                request.MessageDsn.ArrivalDateUtc = requestMessageDsn_messageDsn_UtcArrivalDate.Value;
                requestMessageDsnIsNull           = false;
            }
            List <Amazon.SimpleEmail.Model.ExtensionField> requestMessageDsn_messageDsn_ExtensionField = null;

            if (cmdletContext.MessageDsn_ExtensionField != null)
            {
                requestMessageDsn_messageDsn_ExtensionField = cmdletContext.MessageDsn_ExtensionField;
            }
            if (requestMessageDsn_messageDsn_ExtensionField != null)
            {
                request.MessageDsn.ExtensionFields = requestMessageDsn_messageDsn_ExtensionField;
                requestMessageDsnIsNull            = false;
            }
            System.String requestMessageDsn_messageDsn_ReportingMta = null;
            if (cmdletContext.MessageDsn_ReportingMta != null)
            {
                requestMessageDsn_messageDsn_ReportingMta = cmdletContext.MessageDsn_ReportingMta;
            }
            if (requestMessageDsn_messageDsn_ReportingMta != null)
            {
                request.MessageDsn.ReportingMta = requestMessageDsn_messageDsn_ReportingMta;
                requestMessageDsnIsNull         = false;
            }
            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            System.DateTime?requestMessageDsn_messageDsn_ArrivalDate = null;
            if (cmdletContext.MessageDsn_ArrivalDate != null)
            {
                if (cmdletContext.MessageDsn_UtcArrivalDate != null)
                {
                    throw new System.ArgumentException("Parameters MessageDsn_ArrivalDate and MessageDsn_UtcArrivalDate are mutually exclusive.", nameof(this.MessageDsn_ArrivalDate));
                }
                requestMessageDsn_messageDsn_ArrivalDate = cmdletContext.MessageDsn_ArrivalDate.Value;
            }
            if (requestMessageDsn_messageDsn_ArrivalDate != null)
            {
                request.MessageDsn.ArrivalDate = requestMessageDsn_messageDsn_ArrivalDate.Value;
                requestMessageDsnIsNull        = false;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            // determine if request.MessageDsn should be set to null
            if (requestMessageDsnIsNull)
            {
                request.MessageDsn = null;
            }
            if (cmdletContext.OriginalMessageId != null)
            {
                request.OriginalMessageId = cmdletContext.OriginalMessageId;
            }

            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);
        }