The CDK Construct Library for AWS::SES
Project description
Amazon Simple Email Service Construct Library
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.
This module is part of the AWS Cloud Development Kit project.
Email receiving
Create a receipt rule set with rules and actions:
const bucket = new s3.Bucket(stack, 'Bucket');
const topic = new sns.Topic(stack, 'Topic');
new ses.ReceiptRuleSet(stack, 'RuleSet', {
rules: [
{
recipients: ['hello@aws.com'],
actions: [
new ses.ReceiptRuleAddHeaderAction({
name: 'X-Special-Header',
value: 'aws'
}),
new ses.ReceiptRuleS3Action({
bucket,
objectKeyPrefix: 'emails/',
topic
})
],
},
{
recipients: ['aws.com'],
actions: [
new ses.ReceiptRuleSnsAction({
topic
})
]
}
]
});
Alternatively, rules can be added to a rule set:
const ruleSet = new ses.ReceiptRuleSet(this, 'RuleSet'):
const awsRule = ruleSet.addRule('Aws', {
recipients: ['aws.com']
});
And actions to rules:
awsRule.addAction(
new ses.ReceiptRuleSnsAction({
topic
});
);
When using addRule
, the new rule is added after the last added rule unless after
is specified.
Drop spams
A rule to drop spam can be added by setting dropSpam
to true
:
new ses.ReceiptRuleSet(this, 'RuleSet', {
dropSpam: true
});
This will add a rule at the top of the rule set with a Lambda action that stops processing messages that have at least one spam indicator. See Lambda Function Examples.
Receipt filter
Create a receipt filter:
new ses.ReceiptFilter(this, 'Filter', {
ip: '1.2.3.4/16' // Will be blocked
})
A white list filter is also available:
new ses.WhiteListReceiptFilter(this, 'WhiteList', {
ips: [
'10.0.0.0/16',
'1.2.3.4/16',
]
});
This will first create a block all filter and then create allow filters for the listed ip addresses.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws_cdk.aws_ses-0.36.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bef06dbf5a97198928d98c5cfba2c4658952550db74aad44f1572779311d6f3 |
|
MD5 | c3f69bb04e4d4650d29d04fc8405bf9a |
|
BLAKE2b-256 | ec897736d34641417cb4f682f6ce6c2a05e7a455b9a389bfff1a13e42054b803 |