sendBounce method

Future<SendBounceResponse> sendBounce({
  1. required String bounceSender,
  2. required List<BouncedRecipientInfo> bouncedRecipientInfoList,
  3. required String originalMessageId,
  4. String? bounceSenderArn,
  5. String? explanation,
  6. MessageDsn? messageDsn,
})

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. For information about receiving email through Amazon SES, see the Amazon SES Developer Guide.

You can execute this operation no more than once per second.

May throw MessageRejected.

Parameter bounceSender : The address to use in the "From" header of the bounce message. This must be an identity that you have verified with Amazon SES.

Parameter bouncedRecipientInfoList : A list of recipients of the bounced message, including the information required to create the Delivery Status Notifications (DSNs) for the recipients. You must specify at least one BouncedRecipientInfo in the list.

Parameter originalMessageId : The message ID of the message to be bounced.

Parameter bounceSenderArn : This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the address in the "From" header of the bounce. For more information about sending authorization, see the Amazon SES Developer Guide.

Parameter explanation : Human-readable text for the bounce message to explain the failure. If not specified, the text will be auto-generated based on the bounced recipient information.

Parameter messageDsn : Message-related DSN fields. If not specified, Amazon SES will choose the values.

Implementation

Future<SendBounceResponse> sendBounce({
  required String bounceSender,
  required List<BouncedRecipientInfo> bouncedRecipientInfoList,
  required String originalMessageId,
  String? bounceSenderArn,
  String? explanation,
  MessageDsn? messageDsn,
}) async {
  ArgumentError.checkNotNull(bounceSender, 'bounceSender');
  ArgumentError.checkNotNull(
      bouncedRecipientInfoList, 'bouncedRecipientInfoList');
  ArgumentError.checkNotNull(originalMessageId, 'originalMessageId');
  final $request = <String, dynamic>{};
  $request['BounceSender'] = bounceSender;
  $request['BouncedRecipientInfoList'] = bouncedRecipientInfoList;
  $request['OriginalMessageId'] = originalMessageId;
  bounceSenderArn?.also((arg) => $request['BounceSenderArn'] = arg);
  explanation?.also((arg) => $request['Explanation'] = arg);
  messageDsn?.also((arg) => $request['MessageDsn'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'SendBounce',
    version: '2010-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['SendBounceRequest'],
    shapes: shapes,
    resultWrapper: 'SendBounceResult',
  );
  return SendBounceResponse.fromXml($result);
}