aws::ses的cdk构造库
aws-cdk.aws-ses的Python项目详细描述
亚马逊简单电子邮件服务构造库
This is a developer preview (public beta) module. Releases might lack important features and might have future breaking changes.
This API is still under active development and subject to non-backward compatible changes or removal in any future version. Use of the API is not recommended in production environments. Experimental APIs are not subject to the Semantic Versioning model.
这个模块是AWS Cloud Development Kit项目的一部分。
电子邮件接收
使用规则和操作创建收据规则集:
constbucket=news3.Bucket(stack,'Bucket');consttopic=newsns.Topic(stack,'Topic');newses.ReceiptRuleSet(stack,'RuleSet',{rules:[{recipients:['hello@aws.com'],actions:[newses.ReceiptRuleAddHeaderAction({name:'X-Special-Header',value:'aws'}),newses.ReceiptRuleS3Action({bucket,objectKeyPrefix:'emails/',topic})],},{recipients:['aws.com'],actions:[newses.ReceiptRuleSnsAction({topic})]}]});
或者,可以将规则添加到规则集:
construleSet=newses.ReceiptRuleSet(this,'RuleSet'):constawsRule=ruleSet.addRule('Aws',{recipients:['aws.com']});
以及对规则的操作:
awsRule.addAction(newses.ReceiptRuleSnsAction({topic}););
使用addRule
时,除非指定了after
,否则新规则将添加在最后添加的规则之后。
投放垃圾邮件
通过将dropSpam
设置为true
:
newses.ReceiptRuleSet(this,'RuleSet',{dropSpam: true});
这将在规则集的顶部添加一个规则,该规则集的lambda操作将停止处理至少有一个垃圾邮件指示器的邮件。见Lambda Function Examples。
接收过滤器
创建收据筛选器:
newses.ReceiptFilter(this,'Filter',{ip:'1.2.3.4/16'// Will be blocked})
还提供白名单过滤器:
newses.WhiteListReceiptFilter(this,'WhiteList',{ips:['10.0.0.0/16','1.2.3.4/16',]});
这将首先创建一个block all筛选器,然后为列出的IP地址创建allow筛选器。