55/**
66 * An object that defines the email template to use for an email message, and the values to use for any message
77 * variables in that template. An *email template* is a type of message template that contains content that you want to
8- * define, save, and reuse in email messages that you send.
8+ * reuse in email messages that you send. You can specifiy the email template by providing the name or ARN of an *email
9+ * template* previously saved in your Amazon SES account or by providing the full template content.
910 */
1011final class Template
1112{
@@ -24,6 +25,16 @@ final class Template
2425 */
2526 private $ templateArn ;
2627
28+ /**
29+ * The content of the template.
30+ *
31+ * > Amazon SES supports only simple substitions when you send email using the `SendEmail` or `SendBulkEmail` operations
32+ * > and you provide the full template content in the request.
33+ *
34+ * @var EmailTemplateContent|null
35+ */
36+ private $ templateContent ;
37+
2738 /**
2839 * An object that defines the values to use for message variables in the template. This object is a set of key-value
2940 * pairs. Each key defines a message variable in the template. The corresponding value defines the value to use for that
@@ -44,6 +55,7 @@ final class Template
4455 * @param array{
4556 * TemplateName?: null|string,
4657 * TemplateArn?: null|string,
58+ * TemplateContent?: null|EmailTemplateContent|array,
4759 * TemplateData?: null|string,
4860 * Headers?: null|array<MessageHeader|array>,
4961 * } $input
@@ -52,6 +64,7 @@ public function __construct(array $input)
5264 {
5365 $ this ->templateName = $ input ['TemplateName ' ] ?? null ;
5466 $ this ->templateArn = $ input ['TemplateArn ' ] ?? null ;
67+ $ this ->templateContent = isset ($ input ['TemplateContent ' ]) ? EmailTemplateContent::create ($ input ['TemplateContent ' ]) : null ;
5568 $ this ->templateData = $ input ['TemplateData ' ] ?? null ;
5669 $ this ->headers = isset ($ input ['Headers ' ]) ? array_map ([MessageHeader::class, 'create ' ], $ input ['Headers ' ]) : null ;
5770 }
@@ -60,6 +73,7 @@ public function __construct(array $input)
6073 * @param array{
6174 * TemplateName?: null|string,
6275 * TemplateArn?: null|string,
76+ * TemplateContent?: null|EmailTemplateContent|array,
6377 * TemplateData?: null|string,
6478 * Headers?: null|array<MessageHeader|array>,
6579 * }|Template $input
@@ -82,6 +96,11 @@ public function getTemplateArn(): ?string
8296 return $ this ->templateArn ;
8397 }
8498
99+ public function getTemplateContent (): ?EmailTemplateContent
100+ {
101+ return $ this ->templateContent ;
102+ }
103+
85104 public function getTemplateData (): ?string
86105 {
87106 return $ this ->templateData ;
@@ -104,6 +123,9 @@ public function requestBody(): array
104123 if (null !== $ v = $ this ->templateArn ) {
105124 $ payload ['TemplateArn ' ] = $ v ;
106125 }
126+ if (null !== $ v = $ this ->templateContent ) {
127+ $ payload ['TemplateContent ' ] = $ v ->requestBody ();
128+ }
107129 if (null !== $ v = $ this ->templateData ) {
108130 $ payload ['TemplateData ' ] = $ v ;
109131 }
0 commit comments