【发布时间】:2021-12-13 15:28:58
【问题描述】:
我在一个区域中有多个 (30 多个) AWS SES 电子邮件模板,最近我不得不为另一个客户使用另一个区域,我想将我的所有模板迁移到新区域。 CLI 没有太大帮助,因为您只能列出模板的名称而不是内容。
【问题讨论】:
标签: amazon-web-services email templates amazon-ses
我在一个区域中有多个 (30 多个) AWS SES 电子邮件模板,最近我不得不为另一个客户使用另一个区域,我想将我的所有模板迁移到新区域。 CLI 没有太大帮助,因为您只能列出模板的名称而不是内容。
【问题讨论】:
标签: amazon-web-services email templates amazon-ses
GetTemplate Command “为您指定的模板显示模板对象(包括主题行、HTML 部分和文本部分)。”
Python SDK 示例:
session = boto3.Session(region_name='us-east-1')
ses = session.client('ses')
# create some dummy templates
for i in range(3):
ses.create_template(Template={
"TemplateName": f'Template{i}',
'HtmlPart': '<body></body>',
'SubjectPart': 'hello',
'TextPart': 'hello'
})
# download them
templates = [ses.get_template(TemplateName=m['Name']) for m in ses.list_templates()['TemplatesMetadata']]
print(templates[0]['Template'])
# --> {'TemplateName': 'Template2', 'SubjectPart': 'hello', 'TextPart': 'hello', 'HtmlPart': '<body></body>'}
【讨论】: