Package software.amazon.awscdk.services.ses


@Stability(Stable) @Deprecated package software.amazon.awscdk.services.ses
Deprecated.

Amazon Simple Email Service Construct Library

---

End-of-Support

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.


This module is part of the AWS Cloud Development Kit project.

Email receiving

Create a receipt rule set with rules and actions (actions can be found in the @aws-cdk/aws-ses-actions package):

 import software.amazon.awscdk.services.s3.*;
 import software.amazon.awscdk.services.ses.actions.*;
 
 
 Bucket bucket = new Bucket(this, "Bucket");
 Topic topic = new Topic(this, "Topic");
 
 ReceiptRuleSet.Builder.create(this, "RuleSet")
         .rules(List.of(ReceiptRuleOptions.builder()
                 .recipients(List.of("hello@aws.com"))
                 .actions(List.of(
                     AddHeader.Builder.create()
                             .name("X-Special-Header")
                             .value("aws")
                             .build(),
                     S3.Builder.create()
                             .bucket(bucket)
                             .objectKeyPrefix("emails/")
                             .topic(topic)
                             .build()))
                 .build(), ReceiptRuleOptions.builder()
                 .recipients(List.of("aws.com"))
                 .actions(List.of(
                     Sns.Builder.create()
                             .topic(topic)
                             .build()))
                 .build()))
         .build();
 

Alternatively, rules can be added to a rule set:

 ReceiptRuleSet ruleSet = new ReceiptRuleSet(this, "RuleSet");
 
 ReceiptRule awsRule = ruleSet.addRule("Aws", ReceiptRuleOptions.builder()
         .recipients(List.of("aws.com"))
         .build());
 

And actions to rules:

 import software.amazon.awscdk.services.ses.actions.*;
 
 ReceiptRule awsRule;
 Topic topic;
 
 awsRule.addAction(Sns.Builder.create()
         .topic(topic)
         .build());
 

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:

 ReceiptRuleSet.Builder.create(this, "RuleSet")
         .dropSpam(true)
         .build();
 

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:

 ReceiptFilter.Builder.create(this, "Filter")
         .ip("1.2.3.4/16")
         .build();
 

An allow list filter is also available:

 AllowListReceiptFilter.Builder.create(this, "AllowList")
         .ips(List.of("10.0.0.0/16", "1.2.3.4/16"))
         .build();
 

This will first create a block all filter and then create allow filters for the listed ip addresses. Deprecated: 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 https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html