Creates an email template. Email templates enable you to send personalized email to one or more destinations in a single API operation. For more information, see the Amazon SES Developer Guide.
You can execute this operation no more than once per second.
Parameters:
-
template_name
(EmailTemplateName)
–
The name of the template.
-
template_content
(EmailTemplateContent)
–
The content of the email template, composed of a subject line, an HTML part, and a text-only part.
-
tags
(Optional[TagList], default:
None
)
–
An array of objects that define the tags (keys and values) to associate with the email template.
Raises:
Source code in docs_src/capo_sesv2/_services/async_se_sv2.py
| async def create_email_template(
self,
template_name: "capo_sesv2.types.email_template_name.EmailTemplateName",
template_content: "capo_sesv2.types.email_template_content.EmailTemplateContent",
*,
config_overrides: Optional[AsyncSESv2ClientConfig] = None,
tags: Optional["capo_sesv2.types.tag_list.TagList"] = None,
) -> "capo_sesv2.types.create_email_template_response.CreateEmailTemplateResponse":
"""<p>Creates an email template. Email templates enable you to send personalized email to one or more destinations in a single API operation. For more information, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/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_name: <p>The name of the template.</p>
template_content: <p>The content of the email template, composed of a subject line, an HTML part, and a text-only part.</p>
tags: <p>An array of objects that define the tags (keys and values) to associate with the email template.</p>
Raises:
capo_sesv2.errors.already_exists_exception.AlreadyExistsException: <p>The resource specified in your request already exists.</p>
capo_sesv2.errors.bad_request_exception.BadRequestException: <p>The input you provided is invalid.</p>
capo_sesv2.errors.limit_exceeded_exception.LimitExceededException: <p>There are too many instances of the specified resource type.</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.create_email_template_request.CreateEmailTemplateRequest]",
) -> AsyncOperationResponse[
"capo_sesv2.types.create_email_template_response.CreateEmailTemplateResponse"
]:
import capo_sesv2._operations.simple_email_service_v2.create_email_template
(
output,
http_response,
) = await capo_sesv2._operations.simple_email_service_v2.create_email_template.async_create_email_template(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateEmailTemplate")
)
input_: capo_sesv2.types.create_email_template_request.CreateEmailTemplateRequest = {
"template_name": template_name,
"template_content": template_content,
}
if tags is not None:
input_["tags"] = tags
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|