# Amazon Simple Email Service Construct Library
<!--BEGIN STABILITY BANNER-->---
![End-of-Support](https://img.shields.io/badge/End--of--Support-critical.svg?style=for-the-badge)
> AWS CDK v1 has reached End-of-Support on 2023-06-01.
> This package is no longer being updated, and users should migrate to AWS CDK v2.
>
> For more information on how to migrate, see the [*Migrating to AWS CDK v2* guide](https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html).
---
<!--END STABILITY BANNER-->
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
## Email receiving
Create a receipt rule set with rules and actions (actions can be found in the
`@aws-cdk/aws-ses-actions` package):
```python
import aws_cdk.aws_s3 as s3
import aws_cdk.aws_ses_actions as actions
bucket = s3.Bucket(self, "Bucket")
topic = sns.Topic(self, "Topic")
ses.ReceiptRuleSet(self, "RuleSet",
rules=[ses.ReceiptRuleOptions(
recipients=["hello@aws.com"],
actions=[
actions.AddHeader(
name="X-Special-Header",
value="aws"
),
actions.S3(
bucket=bucket,
object_key_prefix="emails/",
topic=topic
)
]
), ses.ReceiptRuleOptions(
recipients=["aws.com"],
actions=[
actions.Sns(
topic=topic
)
]
)
]
)
```
Alternatively, rules can be added to a rule set:
```python
rule_set = ses.ReceiptRuleSet(self, "RuleSet")
aws_rule = rule_set.add_rule("Aws",
recipients=["aws.com"]
)
```
And actions to rules:
```python
import aws_cdk.aws_ses_actions as actions
# aws_rule: ses.ReceiptRule
# topic: sns.Topic
aws_rule.add_action(actions.Sns(
topic=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`:
```python
ses.ReceiptRuleSet(self, "RuleSet",
drop_spam=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](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda-example-functions.html).
## Receipt filter
Create a receipt filter:
```python
ses.ReceiptFilter(self, "Filter",
ip="1.2.3.4/16"
)
```
An allow list filter is also available:
```python
ses.AllowListReceiptFilter(self, "AllowList",
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/aws/aws-cdk",
"name": "aws-cdk.aws-ses",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Amazon Web Services",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/98/1a/b5be06d950f9ec4ffb1f6e83f942676d1624456aa1569d1960472e65fa48/aws-cdk.aws-ses-1.204.0.tar.gz",
"platform": null,
"description": "# Amazon Simple Email Service Construct Library\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![End-of-Support](https://img.shields.io/badge/End--of--Support-critical.svg?style=for-the-badge)\n\n> AWS CDK v1 has reached End-of-Support on 2023-06-01.\n> This package is no longer being updated, and users should migrate to AWS CDK v2.\n>\n> For more information on how to migrate, see the [*Migrating to AWS CDK v2* guide](https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html).\n\n---\n<!--END STABILITY BANNER-->\n\nThis module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.\n\n## Email receiving\n\nCreate a receipt rule set with rules and actions (actions can be found in the\n`@aws-cdk/aws-ses-actions` package):\n\n```python\nimport aws_cdk.aws_s3 as s3\nimport aws_cdk.aws_ses_actions as actions\n\n\nbucket = s3.Bucket(self, \"Bucket\")\ntopic = sns.Topic(self, \"Topic\")\n\nses.ReceiptRuleSet(self, \"RuleSet\",\n rules=[ses.ReceiptRuleOptions(\n recipients=[\"hello@aws.com\"],\n actions=[\n actions.AddHeader(\n name=\"X-Special-Header\",\n value=\"aws\"\n ),\n actions.S3(\n bucket=bucket,\n object_key_prefix=\"emails/\",\n topic=topic\n )\n ]\n ), ses.ReceiptRuleOptions(\n recipients=[\"aws.com\"],\n actions=[\n actions.Sns(\n topic=topic\n )\n ]\n )\n ]\n)\n```\n\nAlternatively, rules can be added to a rule set:\n\n```python\nrule_set = ses.ReceiptRuleSet(self, \"RuleSet\")\n\naws_rule = rule_set.add_rule(\"Aws\",\n recipients=[\"aws.com\"]\n)\n```\n\nAnd actions to rules:\n\n```python\nimport aws_cdk.aws_ses_actions as actions\n\n# aws_rule: ses.ReceiptRule\n# topic: sns.Topic\n\naws_rule.add_action(actions.Sns(\n topic=topic\n))\n```\n\nWhen using `addRule`, the new rule is added after the last added rule unless `after` is specified.\n\n### Drop spams\n\nA rule to drop spam can be added by setting `dropSpam` to `true`:\n\n```python\nses.ReceiptRuleSet(self, \"RuleSet\",\n drop_spam=True\n)\n```\n\nThis 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](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda-example-functions.html).\n\n## Receipt filter\n\nCreate a receipt filter:\n\n```python\nses.ReceiptFilter(self, \"Filter\",\n ip=\"1.2.3.4/16\"\n)\n```\n\nAn allow list filter is also available:\n\n```python\nses.AllowListReceiptFilter(self, \"AllowList\",\n ips=[\"10.0.0.0/16\", \"1.2.3.4/16\"\n ]\n)\n```\n\nThis will first create a block all filter and then create allow filters for the listed ip addresses.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "The CDK Construct Library for AWS::SES",
"version": "1.204.0",
"project_urls": {
"Homepage": "https://github.com/aws/aws-cdk",
"Source": "https://github.com/aws/aws-cdk.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f819a215b0098bb8d1def6028ef04613bf1cc12699995b507703d0389f05cb8f",
"md5": "7d5a845669b463e72f835d55be460539",
"sha256": "e5212ae2edddb001a8e8bac5890d7d6b5aca917af93bb97f3386e7fb5077fc08"
},
"downloads": -1,
"filename": "aws_cdk.aws_ses-1.204.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7d5a845669b463e72f835d55be460539",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.7",
"size": 244496,
"upload_time": "2023-06-19T21:01:23",
"upload_time_iso_8601": "2023-06-19T21:01:23.056669Z",
"url": "https://files.pythonhosted.org/packages/f8/19/a215b0098bb8d1def6028ef04613bf1cc12699995b507703d0389f05cb8f/aws_cdk.aws_ses-1.204.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "981ab5be06d950f9ec4ffb1f6e83f942676d1624456aa1569d1960472e65fa48",
"md5": "e906418191d66b1cdf7c03c95d1716cd",
"sha256": "9f805cf494501ddef8c44230ea5af114d408cb2a49ed752cb6b93df024e169d3"
},
"downloads": -1,
"filename": "aws-cdk.aws-ses-1.204.0.tar.gz",
"has_sig": false,
"md5_digest": "e906418191d66b1cdf7c03c95d1716cd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.7",
"size": 245239,
"upload_time": "2023-06-19T21:07:26",
"upload_time_iso_8601": "2023-06-19T21:07:26.401817Z",
"url": "https://files.pythonhosted.org/packages/98/1a/b5be06d950f9ec4ffb1f6e83f942676d1624456aa1569d1960472e65fa48/aws-cdk.aws-ses-1.204.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-19 21:07:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aws",
"github_project": "aws-cdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aws-cdk.aws-ses"
}