Skip to content

put_email_identity_mail_from_attributes async

put_email_identity_mail_from_attributes(
    email_identity: Identity,
    *,
    config_overrides: Optional[AsyncSESv2ClientConfig] = None,
    mail_from_domain: Optional[MailFromDomainName] = None,
    behavior_on_mx_failure: Optional[BehaviorOnMxFailure] = None,
) -> PutEmailIdentityMailFromAttributesResponse

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

Parameters:

  • email_identity (Identity) –

    The verified email identity.

  • mail_from_domain (Optional[MailFromDomainName], default: None ) –

    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.

  • behavior_on_mx_failure (Optional[BehaviorOnMxFailure], default: None ) –

    The action to take if the required MX record isn't found when you send an email. When you set this value to USE_DEFAULT_VALUE, the mail is sent using amazonses.com as the MAIL FROM domain. When you set this value to REJECT_MESSAGE, the Amazon SES API v2 returns a MailFromDomainNotVerifiedException 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 TEMPORARY_FAILURE states.

Raises:

Source code in docs_src/capo_sesv2/_services/async_se_sv2.py
async def put_email_identity_mail_from_attributes(
    self,
    email_identity: "capo_sesv2.types.identity.Identity",
    *,
    config_overrides: Optional[AsyncSESv2ClientConfig] = None,
    mail_from_domain: Optional[
        "capo_sesv2.types.mail_from_domain_name.MailFromDomainName"
    ] = None,
    behavior_on_mx_failure: Optional[
        "capo_sesv2.types.behavior_on_mx_failure.BehaviorOnMxFailure"
    ] = None,
) -> "capo_sesv2.types.put_email_identity_mail_from_attributes_response.PutEmailIdentityMailFromAttributesResponse":
    """<p>Used to enable or disable the custom Mail-From domain configuration for an email identity.</p>

    Args:
        email_identity: <p>The verified email identity.</p>
        mail_from_domain: <p> The custom MAIL FROM domain that you want the verified identity to use. The MAIL FROM domain must meet the following criteria:</p> <ul> <li> <p>It has to be a subdomain of the verified identity.</p> </li> <li> <p>It can't be used to receive email.</p> </li> <li> <p>It can't be used in a "From" address if the MAIL FROM domain is a destination for feedback forwarding emails.</p> </li> </ul>
        behavior_on_mx_failure: <p>The action to take if the required MX record isn't found when you send an email. When you set this value to <code>USE_DEFAULT_VALUE</code>, the mail is sent using <i>amazonses.com</i> as the MAIL FROM domain. When you set this value to <code>REJECT_MESSAGE</code>, the Amazon SES API v2 returns a <code>MailFromDomainNotVerifiedException</code> error, and doesn't attempt to deliver the email.</p> <p>These behaviors are taken when the custom MAIL FROM domain configuration is in the <code>PENDING</code>, <code>FAILED</code>, and <code>TEMPORARY_FAILURE</code> states.</p>

    Raises:
        capo_sesv2.errors.bad_request_exception.BadRequestException: <p>The input you provided is invalid.</p>
        capo_sesv2.errors.not_found_exception.NotFoundException: <p>The resource you attempted to access doesn't exist.</p>
        capo_sesv2.errors.too_many_requests_exception.TooManyRequestsException: <p>Too many requests have been made to the operation.</p>
        capo_sesv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sesv2.types.put_email_identity_mail_from_attributes_request.PutEmailIdentityMailFromAttributesRequest]",
    ) -> AsyncOperationResponse[
        "capo_sesv2.types.put_email_identity_mail_from_attributes_response.PutEmailIdentityMailFromAttributesResponse"
    ]:
        import capo_sesv2._operations.simple_email_service_v2.put_email_identity_mail_from_attributes

        (
            output,
            http_response,
        ) = await capo_sesv2._operations.simple_email_service_v2.put_email_identity_mail_from_attributes.async_put_email_identity_mail_from_attributes(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutEmailIdentityMailFromAttributes")
    )
    input_: capo_sesv2.types.put_email_identity_mail_from_attributes_request.PutEmailIdentityMailFromAttributesRequest = {
        "email_identity": email_identity
    }
    if mail_from_domain is not None:
        input_["mail_from_domain"] = mail_from_domain
    if behavior_on_mx_failure is not None:
        input_["behavior_on_mx_failure"] = behavior_on_mx_failure

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output