Skip to content

put_email_identity_mail_from_attributes

put_email_identity_mail_from_attributes(
    email_identity: Identity,
    *,
    config_overrides: Optional[SESv2ClientConfig] = 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 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.

Raises:

Source code in docs_src/capo_sesv2/_services/se_sv2.py
def put_email_identity_mail_from_attributes(
    self,
    email_identity: "capo_sesv2.types.identity.Identity",
    *,
    config_overrides: Optional[SESv2ClientConfig] = 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>UseDefaultValue</code>, the mail is sent using <i>amazonses.com</i> as the MAIL FROM domain. When you set this value to <code>RejectMessage</code>, the Amazon SES API v2 returns a <code>MailFromDomainNotVerified</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>TemporaryFailure</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.
    """

    def _handler(
        req: "OperationRequest[capo_sesv2.types.put_email_identity_mail_from_attributes_request.PutEmailIdentityMailFromAttributesRequest]",
    ) -> OperationResponse[
        "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 = (
            capo_sesv2._operations.simple_email_service_v2.put_email_identity_mail_from_attributes.put_email_identity_mail_from_attributes(
                req.options, req.input
            )
        )
        return OperationResponse(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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output