为什么无法识别SES自定义模板

时间:2018-12-28 18:14:14

标签: amazon-ses

简单电子邮件服务AWS定制模板

Can anyone tell me what syntax your are using to send a customized email 
template to a verified email address using a Python script?
I can easily send the non-customized AWS supplied template that AWS SES 
provides from a Python script like this:

import os
import boto3
print("** SEND AWS SUPPLIED TEMPLATE ** ")
sendTo = 'myemail@gmail.com'
ses = boto3.client('ses')
response = ses.verify_email_identity(EmailAddress = sendTo)
print(response)

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ses.html#SES.Client.verify_email_identity.html

The above link explains how to use "verify_email_identity()" which works 
well.

But the same link instructs how to use "send_custom_verification_email()"
It requires that the customized template already exist. Mine was created
from a python shell as follows:

>>> import boto3
>>> ses = boto3.client('ses')
>>> response = ses.create_template(Template = {'TemplateName' : 'test1','SubjectPart':'Greetings','TextPart':'hello world','HtmlPart':'<html><head></head><body>Welcome</body>'})
>>> print(response) 

The above creates my customized "test1" template and it can be viewed from
the SES service under the "Email Templates" menu. So it does exist.

Now I attempt to send this "test1" custom template using this python script: 

import os
import boto3
print("** SEND AWS CUSTOMIZED TEMPLATE ** ")
sendTo = 'myemail@gmail.com'
client = boto3.client('ses')
response = client.send_custom_verification_email(EmailAddress = sendTo, TemplateName = 'test1')
print(response)
  

我收到错误消息:CustomVerificationEmailTemplateDoesNotExistException
  botocore.errorfactory.CustomVerificationEmailTemplateDoesNotExistException:   
发生错误(CustomVerificationEmailTemplateDoesNotExist)   调用SendCustomVerificationEmail操作:未知

关于为什么认为自定义模板不存在的任何想法?    谢谢,肯尼

0 个答案:

没有答案