Skip to content

register_mail_domain

register_mail_domain(
    organization_id: OrganizationId,
    domain_name: WorkMailDomainName,
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    client_token: Optional[IdempotencyClientToken] = None,
) -> RegisterMailDomainResponse

Registers a new domain in WorkMail and SES, and configures it for use by WorkMail. Emails received by SES for this domain are routed to the specified WorkMail organization, and WorkMail has permanent permission to use the specified domain for sending your users' emails.

Parameters:

  • client_token (Optional[IdempotencyClientToken], default: None ) –

    Idempotency token used when retrying requests.

  • organization_id (OrganizationId) –

    The WorkMail organization under which you're creating the domain.

  • domain_name (WorkMailDomainName) –

    The name of the mail domain to create in WorkMail and SES.

Raises:

Source code in docs_src/capo_workmail/_services/work_mail.py
def register_mail_domain(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    domain_name: "capo_workmail.types.work_mail_domain_name.WorkMailDomainName",
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    client_token: Optional[
        "capo_workmail.types.idempotency_client_token.IdempotencyClientToken"
    ] = None,
) -> "capo_workmail.types.register_mail_domain_response.RegisterMailDomainResponse":
    """<p>Registers a new domain in WorkMail and SES, and configures it for use by WorkMail. Emails received by SES for this domain are routed to the specified WorkMail organization, and WorkMail has permanent permission to use the specified domain for sending your users' emails.</p>

    Args:
        client_token: <p>Idempotency token used when retrying requests.</p>
        organization_id: <p>The WorkMail organization under which you're creating the domain.</p>
        domain_name: <p>The name of the mail domain to create in WorkMail and SES.</p>

    Raises:
        capo_workmail.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the input parameters don't match the service's restrictions.</p>
        capo_workmail.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeds the limit of the resource.</p>
        capo_workmail.errors.mail_domain_in_use_exception.MailDomainInUseException: <p>The domain you're trying to change is in use by another user or organization in your account. See the error message for details.</p>
        capo_workmail.errors.organization_not_found_exception.OrganizationNotFoundException: <p>An operation received a valid organization identifier that either doesn't belong or exist in the system.</p>
        capo_workmail.errors.organization_state_exception.OrganizationStateException: <p>The organization must have a valid state to perform certain operations on the organization or its members.</p>
        capo_workmail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_workmail.types.register_mail_domain_request.RegisterMailDomainRequest]",
    ) -> OperationResponse[
        "capo_workmail.types.register_mail_domain_response.RegisterMailDomainResponse"
    ]:
        import capo_workmail._operations.work_mail_service.register_mail_domain

        output, http_response = (
            capo_workmail._operations.work_mail_service.register_mail_domain.register_mail_domain(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RegisterMailDomain")
    )
    input_: capo_workmail.types.register_mail_domain_request.RegisterMailDomainRequest = {
        "organization_id": organization_id,
        "domain_name": domain_name,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output