Skip to content
GitHubXDiscordRSS

MailManagerRuleSet

Learn how to create, update, and manage AWS SES MailManagerRuleSets using Alchemy Cloud Control.

The MailManagerRuleSet resource lets you manage AWS SES MailManagerRuleSets for handling incoming emails and applying specific rules to them.

Create a basic MailManagerRuleSet with essential properties.

import AWS from "alchemy/aws/control";
const basicRuleSet = await AWS.SES.MailManagerRuleSet("basic-rule-set", {
RuleSetName: "DefaultRuleSet",
Rules: [
{
RuleName: "FirstRule",
Actions: [
{
S3Action: {
BucketName: "my-email-bucket",
ObjectKeyPrefix: "emails/"
}
}
],
Enabled: true
}
],
Tags: [
{
Key: "Environment",
Value: "Production"
}
]
});

Configure a MailManagerRuleSet with multiple rules and complex actions.

const advancedRuleSet = await AWS.SES.MailManagerRuleSet("advanced-rule-set", {
RuleSetName: "AdvancedRulesSet",
Rules: [
{
RuleName: "SecondRule",
Actions: [
{
S3Action: {
BucketName: "my-email-bucket",
ObjectKeyPrefix: "processed/"
}
},
{
SNSAction: {
TopicArn: "arn:aws:sns:us-east-1:123456789012:EmailNotifications",
Encoding: "UTF-8"
}
}
],
Enabled: true
},
{
RuleName: "ThirdRule",
Actions: [
{
LambdaAction: {
FunctionArn: "arn:aws:lambda:us-east-1:123456789012:function:ProcessEmail",
InvocationType: "RequestResponse"
}
}
],
Enabled: false
}
],
Tags: [
{
Key: "Project",
Value: "EmailProcessing"
}
],
adopt: true
});

Specific Use Case: Rule for Spam Filtering

Section titled “Specific Use Case: Rule for Spam Filtering”

Create a MailManagerRuleSet that filters spam emails based on specific conditions.

const spamFilterRuleSet = await AWS.SES.MailManagerRuleSet("spam-filter-rule-set", {
RuleSetName: "SpamFilterRules",
Rules: [
{
RuleName: "SpamFilterRule",
Actions: [
{
BounceAction: {
Message: "Your email has been identified as spam.",
Sender: "no-reply@example.com",
SmtpReplyCode: "550"
}
}
],
Enabled: true,
ScanEnabled: true
}
],
Tags: [
{
Key: "Purpose",
Value: "Spam Filtering"
}
]
});