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.

referencescleanupcleanup-guide.md

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

Amazon SES Mail Manager Resource Cleanup

Prerequisites

  • boto3 installed: pip install boto3
  • AWS credentials configured with permissions for ses:Delete*, ses:List*, and ses:Get* operations
  • Know which resources to delete (use the list operations in the teardown script to discover them)

⚠️ Important

When you delete an ingress point, the endpoint stops accepting email. Email sent to the deleted endpoint's hostname returns a bounce. Confirm before deleting ingress points in production.

Dependency Order — Delete in Reverse

Resources must be deleted in reverse dependency order. Deleting a traffic policy or rule set that is still attached to an active ingress point will fail.

1. Ingress Points      ← delete first (depends on traffic policy + rule set)
2. Rule Sets           ← delete after all ingress points referencing them are gone
3. Traffic Policies    ← delete after all ingress points referencing them are gone
4. Relays              ← delete after rule sets referencing them are gone
5. Archives            ← async deletion (PENDING_DELETION state)
6. Address Lists       ← delete last (no dependents)

Teardown Script

import boto3

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


def list_all(list_fn, key, **kwargs):
    """Generic paginator for Mail Manager list operations."""
    items = []
    next_token = None
    while True:
        params = {"PageSize": 100, **kwargs}
        if next_token:
            params["NextToken"] = next_token
        response = list_fn(**params)
        items.extend(response.get(key, []))
        next_token = response.get("NextToken")
        if not next_token:
            break
    return items


# Step 1: Delete ingress points first
# WARNING: Deleting an ingress point immediately stops all email delivery.
# Email sent to this endpoint after deletion will bounce.
ingress_points = list_all(client.list_ingress_points, "IngressPoints")
for ip in ingress_points:
    ip_id = ip["IngressPointId"]
    name = ip["IngressPointName"]
    print(f"Deleting ingress point: {name} ({ip_id})")
    client.delete_ingress_point(IngressPointId=ip_id)

# Step 2: Delete rule sets
rule_sets = list_all(client.list_rule_sets, "RuleSets")
for rs in rule_sets:
    rs_id = rs["RuleSetId"]
    print(f"Deleting rule set: {rs['RuleSetName']} ({rs_id})")
    client.delete_rule_set(RuleSetId=rs_id)

# Step 3: Delete traffic policies
policies = list_all(client.list_traffic_policies, "TrafficPolicies")
for tp in policies:
    tp_id = tp["TrafficPolicyId"]
    print(f"Deleting traffic policy: {tp['TrafficPolicyName']} ({tp_id})")
    client.delete_traffic_policy(TrafficPolicyId=tp_id)

# Step 4: Delete relays
relays = list_all(client.list_relays, "Relays")
for relay in relays:
    relay_id = relay["RelayId"]
    print(f"Deleting relay: {relay['RelayName']} ({relay_id})")
    client.delete_relay(RelayId=relay_id)

# Step 5: Delete archives (async — sets state to PENDING_DELETION)
# WARNING: Archive deletion permanently removes all stored emails.
# Export any needed emails before deleting (see archive-guide.md).
archives = list_all(client.list_archives, "Archives")
for archive in archives:
    archive_id = archive["ArchiveId"]
    print(f"Deleting archive: {archive['ArchiveName']} ({archive_id})")
    client.delete_archive(ArchiveId=archive_id)
    # Note: archive is NOT immediately gone — state becomes PENDING_DELETION

# Step 6: Delete address lists
address_lists = list_all(client.list_address_lists, "AddressLists")
for al in address_lists:
    al_id = al["AddressListId"]
    print(f"Deleting address list: {al['AddressListName']} ({al_id})")
    client.delete_address_list(AddressListId=al_id)

print("Cleanup complete.")

Deleting Individual Resources

Ingress Point

# Close the ingress point first (stops accepting connections gracefully)
client.update_ingress_point(
    IngressPointId="inp-xxxx",
    StatusToUpdate="CLOSED",
)

# Then delete
client.delete_ingress_point(IngressPointId="inp-xxxx")

Rule Set

# Returns an error if any ingress point still references this rule set
client.delete_rule_set(RuleSetId="rs-xxxx")

Traffic Policy

# Returns an error if any ingress point still references this policy
client.delete_traffic_policy(TrafficPolicyId="tp-xxxx")

Archive

# WARNING: Archive deletion permanently removes all stored emails.
# Export any needed emails before deleting (see archive-guide.md).
# Deletion is async — archive enters PENDING_DELETION state.
# Archived emails are retained until the deletion completes.
client.delete_archive(ArchiveId="a-xxxx")

# Check status
response = client.get_archive(ArchiveId="a-xxxx")
print(response["ArchiveState"])  # PENDING_DELETION

Add-on Instances and Subscriptions

# Delete instance before subscription
client.delete_addon_instance(AddonInstanceId="ai-xxxx")
client.delete_addon_subscription(AddonSubscriptionId="as-xxxx")

DNS Cleanup

After deleting an ingress point, remove or update the MX record for your domain. Leaving an MX record pointing to a deleted ingress point will cause email to bounce.

# Verify the ingress point hostname is no longer resolving
dig MX yourdomain.com

Common Errors During Cleanup

Error Cause Fix
ResourceNotFoundException Resource already deleted or wrong ID Check IDs with list operations first
ConflictException Ingress point still references the resource Delete ingress points first
ValidationException on archive delete Archive already in PENDING_DELETION No action needed — already being deleted

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