Skip to content

test_render_email_template

test_render_email_template(
    template_name: EmailTemplateName,
    template_data: EmailTemplateData,
    *,
    config_overrides: Optional[SESv2ClientConfig] = None,
) -> TestRenderEmailTemplateResponse

Creates a preview of the MIME content of an email when provided with a template and a set of replacement data.

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

Parameters:

  • template_name (EmailTemplateName) –

    The name of the template.

  • template_data (EmailTemplateData) –

    A list of replacement values to apply to the template. This parameter is a JSON object, typically consisting of key-value pairs in which the keys correspond to replacement tags in the email template.

Raises:

Source code in docs_src/capo_sesv2/_services/se_sv2.py
def test_render_email_template(
    self,
    template_name: "capo_sesv2.types.email_template_name.EmailTemplateName",
    template_data: "capo_sesv2.types.email_template_data.EmailTemplateData",
    *,
    config_overrides: Optional[SESv2ClientConfig] = None,
) -> "capo_sesv2.types.test_render_email_template_response.TestRenderEmailTemplateResponse":
    """<p>Creates a preview of the MIME content of an email when provided with a template and a set of replacement data.</p> <p>You can execute this operation no more than once per second.</p>

    Args:
        template_name: <p>The name of the template.</p>
        template_data: <p>A list of replacement values to apply to the template. This parameter is a JSON object, typically consisting of key-value pairs in which the keys correspond to replacement tags in the email template.</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.test_render_email_template_request.TestRenderEmailTemplateRequest]",
    ) -> OperationResponse[
        "capo_sesv2.types.test_render_email_template_response.TestRenderEmailTemplateResponse"
    ]:
        import capo_sesv2._operations.simple_email_service_v2.test_render_email_template

        output, http_response = (
            capo_sesv2._operations.simple_email_service_v2.test_render_email_template.test_render_email_template(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TestRenderEmailTemplate")
    )
    input_: capo_sesv2.types.test_render_email_template_request.TestRenderEmailTemplateRequest = {
        "template_name": template_name,
        "template_data": template_data,
    }

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