通过 python lambda 函数使用 boto3 的 AWS SES 电子邮件
AWS SES Email using boto3 through python lambda function
boto3.client('ses').send_email(
Source = email_from,
Destination={
'ToAddresses': [
email_to,
]
},
Message={
'Subject': {
'Data': emaiL_subject
},
'Body': {
'Text': {
'Data': email_body.format(user_password)
}
}
}
)
我正在使用 boto3 SES,通过 lambda 函数执行上述代码后出现以下错误:
Could not connect to the endpoint URL: \"https://email.ap-southeast-1.amazonaws.com/\
对于 Lambda 函数,我的区域是 ap-southeast-1
任何帮助都将得到应用
问题已通过硬编码区域字符串解决 'us-east-1'
现在我将客户端创建为:
boto3.client('ses', 'us-east-1')
我认为这是因为 SES 在新加坡地区不可用。
AWS 目前仅为 6 个区域提供 SES 服务:
- 美国东部(弗吉尼亚北部)
us-east-1
- 美国西部(俄勒冈)
us-west-2
- 欧盟(爱尔兰)
eu-west-1
- 美联社(孟买)
ap-south-1
- AP(悉尼)
ap-southeast-2
- 欧盟(法兰克福)
eu-central-1
使用以上之一作为你的AWS_REGION
client = boto3.client('ses',region_name=AWS_REGION)
注意:在 AWS website.
上查找最新的区域列表
使用前随时检查 AWS 服务的状态及其在不同地区的可用性
boto3.client('ses').send_email(
Source = email_from,
Destination={
'ToAddresses': [
email_to,
]
},
Message={
'Subject': {
'Data': emaiL_subject
},
'Body': {
'Text': {
'Data': email_body.format(user_password)
}
}
}
)
我正在使用 boto3 SES,通过 lambda 函数执行上述代码后出现以下错误:
Could not connect to the endpoint URL: \"https://email.ap-southeast-1.amazonaws.com/\
对于 Lambda 函数,我的区域是 ap-southeast-1
任何帮助都将得到应用
问题已通过硬编码区域字符串解决 'us-east-1'
现在我将客户端创建为:
boto3.client('ses', 'us-east-1')
我认为这是因为 SES 在新加坡地区不可用。
AWS 目前仅为 6 个区域提供 SES 服务:
- 美国东部(弗吉尼亚北部)
us-east-1
- 美国西部(俄勒冈)
us-west-2
- 欧盟(爱尔兰)
eu-west-1
- 美联社(孟买)
ap-south-1
- AP(悉尼)
ap-southeast-2
- 欧盟(法兰克福)
eu-central-1
使用以上之一作为你的AWS_REGION
client = boto3.client('ses',region_name=AWS_REGION)
注意:在 AWS website.
上查找最新的区域列表