Index of every page on this site: llms.txt
All skills
amazon-ses avatar

/aws-mail-manager

@58f234e
Run it yourself

Process, route, filter, and archive inbound email with Amazon SES Mail Manager. Use when building email ingress pipelines, spam/IP filtering, compliance archiving, SMTP relay forwarding, address allow/block lists, or any inbound email processing workflow. Covers ingress points, traffic policies, rule sets, relays, archives, and address lists.

Use this Skill: https://skilld.dev/gh/amazon-ses/skills/aws-mail-manager

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesworkflowsevent-driven-ai-pipeline.md

≈1.9k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Event-Driven AI Processing Pipeline

Mail Manager can serve as the front-end for email-driven AI processing workflows. Inbound email arrives at the ingress point, passes through traffic policy filtering, and rule set actions route it to downstream services (S3, SNS, Lambda) where AI models analyze, categorize, or respond to the content.

Prerequisites

  • AWS account with Amazon SES Mail Manager enabled
  • boto3 installed: pip install boto3
  • AWS credentials configured with permissions for Mail Manager, Amazon S3, and AWS Lambda
  • An Amazon Bedrock model enabled in your account (for AI processing)

Architecture Pattern

Internet → Ingress Point → Traffic Policy → Rule Set
                                              ├── WriteToS3 (store raw email)
                                              ├── Archive (compliance copy)
                                              └── PublishToSns or S3 Event
                                                    ↓
                                              Lambda Function
                                                    ↓
                                              AI/ML Processing
                                              (Bedrock, Comprehend, etc.)
                                                    ↓
                                              Action (SNS, SQS, DynamoDB,
                                              Connect, etc.)

How It Works

  1. Mail Manager receives inbound email via an OPEN ingress point
  2. Traffic policy filters connections (TLS, IP, recipient, add-on scanning)
  3. Rule set actions run in order:
    • WriteToS3 stores the raw MIME email in an S3 bucket
    • Archive keeps a compliance copy in Mail Manager's searchable archive
    • Optionally, PublishToSns sends a notification to trigger processing
  4. An S3 event notification (or Amazon SNS subscription) triggers an AWS Lambda function
  5. The AWS Lambda function parses the email and sends it to an AI model (such as Amazon Bedrock) for categorization, urgency assignment, or response generation
  6. Results are routed to downstream systems (Amazon SNS topics per category, Amazon SQS queues, Amazon DynamoDB, Amazon Connect for outbound calls)

Reference Implementation

The Generative AI Email Categorization using SES Mail Manager project on GitHub demonstrates this pattern end-to-end. It deploys:

  • S3 bucket for inbound email storage
  • S3 Lambda notification trigger on new objects
  • Lambda function that parses MIME emails and calls Amazon Bedrock (Nova Micro) for categorization and urgency assignment
  • Mail Manager traffic policy, rule set, and ingress point configured to write to S3
  • SNS topics and SQS queues per category (such as tech support, billing, content)
  • DynamoDB table for storing categorization results
  • Third-party add-on integration for virus/spam scanning

The project is CDK-based (TypeScript) and deploys the full stack with:

cdk deploy \
  --parameters allowListedEmailAddress="support@example.com" \
  --parameters securityAddonARN="arn:aws:ses:us-east-1:123456789012:addon-instance/ai-xxxx"

Key Configuration Decisions

S3 trigger vs SNS trigger vs InvokeLambda

Approach Pros Cons
S3 event → Lambda Email content is already in S3 for Lambda to read One trigger per object, harder to fan out
SNS → Lambda Can fan out to multiple subscribers, decoupled Lambda receives notification metadata, must fetch email from S3 or archive separately
InvokeLambda action Direct invocation from the rule set, no intermediate service. Supports sync (REQUEST_RESPONSE) and async (EVENT) modes with configurable retry (up to 36 hours) Lambda payload uses SES Email Receiving format, not raw MIME

The reference implementation uses S3 event notifications. For new pipelines, consider the InvokeLambda action for a more direct architecture — it invokes the Lambda directly from the rule set without needing an S3 bucket or SNS topic as an intermediary.

Rule set action order

For AI processing pipelines, the recommended action order is:

  1. Archive first — this helps create a compliance copy even if downstream processing fails
  2. WriteToS3 second — triggers the processing pipeline
  3. AddHeader (optional) — tag the message for downstream routing

Set ActionFailurePolicy: CONTINUE on Archive so that S3 delivery proceeds even if archiving has a transient failure.

Add-on scanning

Consider using a Mail Manager add-on (third-party security scanning service) as a traffic policy condition to drop malicious email before it reaches your AI pipeline. This prevents wasting compute on spam/malware and reduces the risk of prompt injection via email content.

Cost considerations

This pattern incurs charges for:

  • Mail Manager ingress point (per-message processing)
  • Archive storage (based on email volume and retention period)
  • S3 storage (raw email objects)
  • Lambda invocations and duration
  • Amazon Bedrock model inference calls

Delete resources when no longer needed. See Cleanup.

Mail Manager Configuration for This Pattern

import boto3

client = boto3.client('mailmanager', region_name='us-east-1')

# Rule set: archive + write to S3 (triggers Lambda via S3 event)
rule_set = client.create_rule_set(
    RuleSetName='ai-email-pipeline',
    Rules=[
        {
            'Name': 'archive-and-process',
            'Actions': [
                {
                    'Archive': {
                        'TargetArchive': archive_id,
                        'ActionFailurePolicy': 'CONTINUE'
                    }
                },
                {
                    'WriteToS3': {
                        'S3Bucket': 'amzn-s3-demo-bucket-processing',
                        'RoleArn': s3_write_role_arn,
                        'S3Prefix': 'inbound/',
                        'ActionFailurePolicy': 'CONTINUE'
                    }
                }
            ]
        }
    ]
)

The Lambda function, Bedrock integration, and downstream routing are outside Mail Manager's scope — see the reference implementation for the complete solution.

Cleanup

To tear down the Mail Manager components of this pipeline:

  1. Delete the ingress point (stops email processing)
  2. Delete the rule set
  3. Delete the traffic policy
  4. Delete the archive (async — enters PENDING_DELETION). Warning: this permanently removes all stored emails. Export any needed messages first.
  5. Empty and delete the S3 bucket. Warning: this permanently removes all stored email objects.

For the full teardown procedure, see the Cleanup Guide. The Lambda function, SNS topics, and other downstream resources are managed separately (or via cdk destroy if using the reference implementation).

Related

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts5mo3 checks · Risk SAFE
  • Gen Agent Trust Hub5mo

    This skill provides comprehensive documentation and code examples for managing Amazon SES Mail Manager. It enables AI agents to assist in setting up email ingress pipelines, traffic policies, rule sets, and archiving workflows using official AWS SDKs and infrastructure-as-code tools. No malicious patterns or security vulnerabilities were detected.

  • Socket5mo

    No alerts

  • Snyk5mo

    Risk: LOW · No issues

Signed by skilld at 58f234e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 6 months ago
Other metadata
compatibility
Requires AWS credentials (IAM user, role, or environment variables) and an AWS account with Amazon SES Mail Manager enabled. Python SDK — boto3 with client name 'mailmanager'. Available in all commercial AWS regions where SES is offered (27 regions as of December 2025). See https://aws.amazon.com/about-aws/whats-new/2025/12/ses-mail-manager-10-regions/ for the latest availability.
metadata
{
  "author": "aws",
  "version": "1.0",
  "service": "mailmanager",
  "revision": 1,
  "updated-on": "2026-03-20",
  "source": "maintainer",
  "tags": "ses,mail-manager,email,smtp,ingress,archive,relay,traffic-policy,rule-set"
}

README badge

README badge for amazon-ses/skills/aws-mail-manager