Skip to content

create_template

create_template(
    template: Template, *, config_overrides: Optional[SESClientConfig] = None
) -> CreateTemplateResponse

Creates an email template. Email templates enable you to send personalized email to one or more destinations in a single operation. For more information, see the Amazon SES Developer Guide.

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

Parameters:

  • template (Template) –

    The content of the email, composed of a subject line and either an HTML part or a text-only part.

Raises:

Source code in docs_src/capo_ses/_services/ses.py
def create_template(
    self,
    template: "capo_ses.types.template.Template",
    *,
    config_overrides: Optional[SESClientConfig] = None,
) -> "capo_ses.types.create_template_response.CreateTemplateResponse":
    """<p>Creates an email template. Email templates enable you to send personalized email to one or more destinations in a single operation. For more information, see the <a href="https://docs.aws.amazon.com/ses/latest/dg/send-personalized-email-api.html">Amazon SES Developer Guide</a>.</p> <p>You can execute this operation no more than once per second.</p>

    Args:
        template: <p>The content of the email, composed of a subject line and either an HTML part or a text-only part.</p>

    Raises:
        capo_ses.errors.already_exists_exception.AlreadyExistsException: <p>Indicates that a resource could not be created because of a naming conflict.</p>
        capo_ses.errors.invalid_template_exception.InvalidTemplateException: <p>Indicates that the template that you specified could not be rendered. This issue may occur when a template refers to a partial that does not exist.</p>
        capo_ses.errors.limit_exceeded_exception.LimitExceededException: <p>Indicates that a resource could not be created because of service limits. For a list of Amazon SES limits, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/limits.html">Amazon SES Developer Guide</a>.</p>
        capo_ses.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ses.types.create_template_request.CreateTemplateRequest]",
    ) -> OperationResponse[
        "capo_ses.types.create_template_response.CreateTemplateResponse"
    ]:
        import capo_ses._operations.simple_email_service.create_template

        output, http_response = (
            capo_ses._operations.simple_email_service.create_template.create_template(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTemplate")
    )
    input_: capo_ses.types.create_template_request.CreateTemplateRequest = {
        "template": template
    }

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