putEmailIdentityMailFromAttributes method

Future<void> putEmailIdentityMailFromAttributes({
  1. required String emailIdentity,
  2. BehaviorOnMxFailure? behaviorOnMxFailure,
  3. String? mailFromDomain,
})

Used to enable or disable the custom Mail-From domain configuration for an email identity.

May throw NotFoundException. May throw TooManyRequestsException. May throw BadRequestException.

Parameter emailIdentity : The verified email identity that you want to set up the custom MAIL FROM domain for.

Parameter behaviorOnMxFailure : The action that you want to take if the required MX record isn't found when you send an email. When you set this value to UseDefaultValue, the mail is sent using amazonses.com as the MAIL FROM domain. When you set this value to RejectMessage, the Amazon SES API v2 returns a MailFromDomainNotVerified error, and doesn't attempt to deliver the email.

These behaviors are taken when the custom MAIL FROM domain configuration is in the Pending, Failed, and TemporaryFailure states.

Parameter mailFromDomain : The custom MAIL FROM domain that you want the verified identity to use. The MAIL FROM domain must meet the following criteria:

  • It has to be a subdomain of the verified identity.
  • It can't be used to receive email.
  • It can't be used in a "From" address if the MAIL FROM domain is a destination for feedback forwarding emails.

Implementation

Future<void> putEmailIdentityMailFromAttributes({
  required String emailIdentity,
  BehaviorOnMxFailure? behaviorOnMxFailure,
  String? mailFromDomain,
}) async {
  ArgumentError.checkNotNull(emailIdentity, 'emailIdentity');
  _s.validateStringLength(
    'emailIdentity',
    emailIdentity,
    1,
    1152921504606846976,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    if (behaviorOnMxFailure != null)
      'BehaviorOnMxFailure': behaviorOnMxFailure.toValue(),
    if (mailFromDomain != null) 'MailFromDomain': mailFromDomain,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/v2/email/identities/${Uri.encodeComponent(emailIdentity)}/mail-from',
    exceptionFnMap: _exceptionFns,
  );
}