问题描述: 当使用Amazon Web Services (AWS)中的Simple Email Service (SES)将电子邮件发送到SNS时,SNS操作未收到邮件的内容。
解决步骤:
确认您的SNS主题的订阅者列表中包含电子邮件。
配置您的SNS主题以接收AWS SES发送的电子邮件。将SNS主题的协议设置为email,并将主题的Endpoint设置为您的电子邮件地址。
示例代码:
import boto3
client = boto3.client('ses')
response = client.set_identity_notification_topic( Identity='example.com', NotificationType='Bounce', SnsTopic='arn:aws:sns:us-west-2:111122223333:example-topic' )
import boto3
client = boto3.client('ses')
response = client.create_receipt_rule(
RuleSetName='MyRuleSet',
After='MyRule',
Enabled=True,
recipients=[],
actions=[{
'S3Action': {
'TopicArn': 'arn:aws:sns:us-west-2:111122223333:example-topic',
'BucketName': 'examplebucket',
'ObjectKeyPrefix': 'emails/',
'Encryption': {
'S3EncryptionMode': 'SSE-S3'
}
}
}],
scan_enabled=True
)