ses-troubleshoot
npx skills add https://github.com/wraps-team/skills --skill ses-troubleshoot
Agent 安装分布
Skill 文档
SES Deliverability Troubleshooter
Interactive diagnostician for AWS SES email delivery problems. When a user reports an email issue, identify the symptom, run targeted diagnostics, correlate findings, and provide ordered remediation.
How to Use This Skill
You are an interactive diagnostician. Do NOT dump all sections at the user. Instead:
- Identify the symptom (ask if unclear)
- Run the diagnostic commands for that symptom
- Interpret the results using the thresholds below
- Correlate multiple findings (problems are often related)
- Provide ordered remediation steps (most impactful first)
Step 1: Identify the Symptom
Ask which problem they’re experiencing, then follow the matching branch:
- Emails bouncing â Bounce Diagnosis
- Emails going to spam/junk â Spam Diagnosis
- Emails not sending at all â Send Failure Diagnosis
- SES account under review/paused â Account Health Diagnosis
- High complaint rate â Complaint Diagnosis
- Delivery delays â Delay Diagnosis
Step 2: Gather Context
Before running diagnostics, gather the user’s domain and region from Wraps metadata:
# Read connection metadata to get domain, region, and config
cat ~/.wraps/connections/*.json
Metadata JSON paths:
- Region:
.region(top-level) - Domain:
.services.email.config.domain - Provider:
.provider - Account ID:
.accountId - Preset:
.services.email.preset - MAIL FROM subdomain:
.services.email.config.mailFromSubdomain
Then check AWS connectivity:
aws sts get-caller-identity
Primary Diagnostic Tool: email check
The Wraps CLI includes a comprehensive deliverability checker. Always use --json for structured output that’s easy to interpret programmatically:
npx @wraps.dev/cli email check <domain> --json
This single command checks all of the following:
- SPF: Record, validity, DNS lookup count (max 10),
allmechanism - DKIM: Automatically finds correct SES token-based selectors (NOT
selector1/2/3), key type and size - DMARC: Policy, alignment, reporting configuration
- MX Records: Existence, resolution, redundancy
- Mail Server TLS: STARTTLS support, TLS version on each MX server
- Reverse DNS: PTR records for all MX IPs
- IPv6: MX AAAA records and SPF IPv6 coverage
- Blacklists: 12+ domain blacklists, 30+ IP blacklists per MX IP (165+ total checks)
- Domain Age: Registration date, registrar, RDAP data
- DNSSEC, CAA, BIMI, MTA-STS, TLS-RPT: Advanced security checks
- Score: 0-100 score with grade (A/B/C/D/F), deductions, and bonuses
Key JSON paths in the response:
- Overall:
.score.grade,.score.finalScore,.score.deductions[] - SPF:
.spf.exists,.spf.valid,.spf.record,.spf.lookupCount,.spf.allMechanism - DKIM:
.dkim.found,.dkim.selectors[].valid,.dkim.selectors[].keyBits - DMARC:
.dmarc.exists,.dmarc.valid,.dmarc.policy,.dmarc.reportingEnabled - MX:
.mx.exists,.mx.records[],.mx.hasRedundancy - Blacklists:
.blacklist.overallClean,.blacklist.ipChecks.listed[],.blacklist.domainChecks.listed[] - Domain age:
.domainAge.ageInDays,.domainAge.createdAt
Grade thresholds:
- A (90-100): Excellent, all best practices followed
- B (75-89): Good, minor improvements possible
- C (60-74): Fair, notable issues to address
- D (40-59): Poor, significant problems
- F (0-39): Failing, critical issues
Use this command as the first diagnostic step for any symptom involving DNS, authentication, or reputation. It replaces the need for individual dig, nslookup, or manual DNS commands.
SES Account Diagnostics
For account-level checks, run get-account once and interpret multiple fields:
aws sesv2 get-account --region <region>
Key fields to inspect from the single response:
| Field | What it tells you |
|---|---|
SendingEnabled |
Whether the account can send at all |
ProductionAccessEnabled |
false = sandbox mode (200/day, verified recipients only) |
EnforcementStatus |
HEALTHY, PROBATION, or SHUTDOWN |
Details.ReviewDetails.Status |
PENDING, GRANTED, DENIED, or FAILED |
SendQuota.Max24HourSend |
Daily sending limit |
SendQuota.SentLast24Hours |
Emails sent in rolling 24h window |
SendQuota.MaxSendRate |
Max emails per second |
SuppressionAttributes.SuppressedReasons |
What gets auto-suppressed |
Important: get-account does NOT return bounce/complaint rate percentages directly. Those are available in the SES console’s Reputation Dashboard or via Virtual Deliverability Manager metrics. The thresholds below are for interpreting those rates when the user provides them or when checking the console.
Bounce Diagnosis
Check 1: Run email check
npx @wraps.dev/cli email check <domain> --json
Look at .score.grade and .score.deductions[] for DNS/authentication issues that could cause bounces.
Check 2: SES account status
aws sesv2 get-account --region <region>
Check EnforcementStatus and compare SentLast24Hours to Max24HourSend. If near the limit, sends are throttled or rejected.
Bounce rate thresholds (from SES console Reputation Dashboard):
| Rate | Status | Action |
|---|---|---|
| < 2% | Healthy | Investigate individual cases |
| 2-5% | Warning | Clean list, check recent imports |
| 5-10% | Critical | Stop marketing sends, aggressive cleanup |
| > 10% | Danger | SES will suspend account |
Check 3: Suppression list
# List all suppressed addresses
aws sesv2 list-suppressed-destinations --region <region>
# Filter by bounce vs complaint
aws sesv2 list-suppressed-destinations --region <region> --reasons BOUNCE
aws sesv2 list-suppressed-destinations --region <region> --reasons COMPLAINT
If suppression list is large, it often indicates a bad import or list hygiene issue. To remove a false positive:
aws sesv2 delete-suppressed-destination \
--email-address user@example.com --region <region>
Bounce Remediation (ordered by impact)
- DNS issues â Fix SPF/DKIM/DMARC records based on
email checkfindings - Suppression list bloated â Clean suppression list + fix source data quality
- Bounce rate > 5% â Pause marketing sends, run engagement-based list cleanup
- Sending quota hit â Request limit increase in AWS Console â SES â Account Dashboard
- Bad import â Validate email addresses before importing (use verification service)
Spam Diagnosis
Check 1: Comprehensive email check
npx @wraps.dev/cli email check <domain> --json
Interpret the JSON response – key things to look for:
SPF (.spf): Must include amazonses.com. Check .spf.allMechanism â should be - (hard fail). ~ (soft fail) is acceptable but weaker.
DKIM (.dkim): At least one valid selector with 2048-bit RSA key. The CLI automatically checks the correct SES token-based selectors (e.g., bsksdtrd66emmvw6frf33yopnumfs33r._domainkey), NOT the generic selector1/2/3 names.
DMARC (.dmarc): Policy should be quarantine or reject (NOT none). If .dmarc.policy is none, inbox providers may deprioritize emails. Recommended record:
_dmarc.<domain> TXT "v=DMARC1; p=reject; rua=mailto:dmarc@<domain>"
Blacklists (.blacklist): Check .blacklist.overallClean. If false, inspect .blacklist.ipChecks.listed[] and .blacklist.domainChecks.listed[]. Note the priority field â high priority listings are critical, low priority (like cbl.anti-spam.org.cn) are less impactful but should still be addressed.
Domain Age (.domainAge.ageInDays): Domains < 30 days old have inherently low reputation.
Check 2: DMARC alignment and MAIL FROM
Check the MAIL FROM configuration from the SES identity:
aws sesv2 get-email-identity --email-identity <domain> --region <region>
Look at MailFromAttributes:
MailFromDomain: Should be a subdomain likemail.<domain>MailFromDomainStatus: Should beSUCCESS
If MAIL FROM is not configured, set it up with these DNS records:
- MX record:
mail.<domain> MX 10 feedback-smtp.<region>.amazonses.com - SPF record:
mail.<domain> TXT "v=spf1 include:amazonses.com ~all"
Check 3: Domain and account reputation
aws sesv2 get-account --region <region>
Check EnforcementStatus (HEALTHY, PROBATION, SHUTDOWN).
For new domains (< 30 days old), low reputation is expected. Follow warming schedule:
- Days 1-2: 200 emails
- Days 3-7: 500-1,000
- Days 8-14: 5,000
- Days 15-30: 10,000-25,000
Check 4: Content analysis
Ask the user for a recent email’s HTML or subject line. Check for:
- Spam trigger words: FREE, WINNER, ACT NOW, LIMITED TIME, URGENT, $$
- Image-to-text ratio: Should be < 40% images
- URL shorteners: bit.ly, tinyurl are heavily penalized by spam filters
- Link count: More than 5-7 links looks spammy
- Missing plain text: HTML-only emails are flagged by some filters
- Missing unsubscribe: Required for marketing emails
Spam Remediation (ordered by impact)
- Fix DNS â Address all issues from
email checkdeductions - Set up custom MAIL FROM domain â Improves DMARC alignment
- Request blacklist delisting â Use the
delistUrlfrom listed entries, or visit the blacklist’s website - Warm sending gradually â Follow warming schedule for new/cold domains
- Clean content â Remove spam triggers, add plain text version, reduce link count
- Add List-Unsubscribe header â Required for marketing, improves inbox placement
Send Failure Diagnosis
Check 1: SES account status (sandbox, quota, enforcement)
aws sesv2 get-account --region <region>
Check all of these from the single response:
ProductionAccessEnabled: Iffalse, account is in sandbox mode (200 emails/day, verified recipients only). Fix: Request production access in AWS Console â SES â Account Dashboard.SendQuota: IfSentLast24Hoursequals or exceedsMax24HourSend, all sends are rejected until the 24-hour window rolls.SendingEnabled: Iffalse, sending is disabled entirely.EnforcementStatus: If not HEALTHY, account may be restricted.
Check 2: Domain verification
aws sesv2 get-email-identity --email-identity <domain> --region <region>
Check VerifiedForSendingStatus. If false, the domain isn’t verified:
- Run
npx @wraps.dev/cli email check <domain> --jsonto see DKIM status - DNS propagation takes 5-60 minutes
- Verify with:
npx @wraps.dev/cli email verify --domain <domain>
Check 3: IAM permissions
npx @wraps.dev/cli email status
The IAM role must have ses:SendEmail and ses:SendRawEmail permissions. If using Vercel OIDC, verify the trust relationship is configured correctly.
Check 4: Configuration set
aws sesv2 get-configuration-set \
--configuration-set-name wraps-email-tracking --region <region>
If this returns a 404, the configuration set is missing. Check event destinations:
aws sesv2 get-configuration-set-event-destinations \
--configuration-set-name wraps-email-tracking --region <region>
Send Failure Remediation (ordered)
- Sandbox â Request production access via AWS Console
- Quota hit â Request limit increase, or spread sends over time
- Domain not verified â Check DKIM records with
email check, wait for propagation - Permissions â Run
npx @wraps.dev/cli email initto recreate/fix IAM role - Config set missing â Run
npx @wraps.dev/cli email upgradeto recreate
Account Health Diagnosis
Check 1: Account status
aws sesv2 get-account --region <region>
Key fields:
EnforcementStatus: HEALTHY, PROBATION, or SHUTDOWNDetails.ReviewDetails: Any ongoing AWS reviewProductionAccessEnabled: Whether production sending is allowed
Check 2: Reputation metrics
From the same get-account response, note the enforcement status. For actual bounce/complaint rate percentages, check the SES console Reputation Dashboard or Virtual Deliverability Manager.
| Metric | Healthy | Warning | Critical |
|---|---|---|---|
| Bounce Rate | < 2% | 2-5% | > 5% |
| Complaint Rate | < 0.1% | 0.1-0.3% | > 0.3% |
Check 3: Email check for DNS/reputation issues
npx @wraps.dev/cli email check <domain> --json
Check for blacklist listings, domain age, and authentication issues that could be contributing to account health problems.
Check 4: CloudWatch alarms
aws cloudwatch describe-alarms \
--alarm-name-prefix wraps --region <region>
Check if any alarms are in ALARM state.
Account Health Remediation
If PROBATION:
- Immediately reduce sending volume
- Pause all marketing/bulk sends
- Clean contact lists aggressively (remove anyone not engaged in 90 days)
- Fix the root cause (bad import, spam content, missing unsubscribe)
- Monitor daily until status returns to HEALTHY
If SHUTDOWN:
- Appeal via AWS Support case
- Document: what caused the issue, steps taken, prevention plan
- Demonstrate compliance improvements before requesting reinstatement
Complaint Diagnosis
Check 1: Account status and complaint rate
aws sesv2 get-account --region <region>
Check EnforcementStatus. For actual complaint rate, check SES console Reputation Dashboard.
Complaint rate thresholds:
| Rate | Status | Action |
|---|---|---|
| < 0.1% | Healthy | Continue normally |
| 0.1-0.3% | Warning | Review content and targeting |
| 0.3-0.5% | Critical | Pause marketing emails |
| > 0.5% | Danger | SES may suspend account |
Check 2: Suppression list (complaint-sourced)
aws sesv2 list-suppressed-destinations --region <region> --reasons COMPLAINT
High complaint suppression count indicates content or targeting problems.
Check 3: Unsubscribe mechanism
Verify emails include:
- Visible unsubscribe link in email body
List-Unsubscribeheader (RFC 8058)List-Unsubscribe-Post: List-Unsubscribe=One-Clickheader- One-click unsubscribe that works without login
Complaint Remediation (ordered)
- Add 1-click unsubscribe â Every marketing email must have List-Unsubscribe header
- Add preference center â Let users choose frequency and topics
- Review content relevance â Only send what users signed up for
- Segment by engagement â Only send marketing to contacts who opened in last 90 days
- Verify consent â Was the list properly opted-in? Double opt-in prevents complaints
Delay Diagnosis
Check 1: SES sending rate
aws sesv2 get-account --region <region>
Check SendQuota.MaxSendRate. If you’re sending faster than this (emails per second), SES throttles delivery.
Check 2: Delivery delay events
If Wraps event tracking is enabled, check for DELIVERY_DELAY events in the DynamoDB table. Common causes:
- Recipient mail server is throttling (greylisting)
- DNS resolution delays
- Recipient server temporarily unavailable
Check 3: Sending pattern
Are sends happening in bursts? Large bursts trigger:
- SES throttling (rate limit enforcement)
- Recipient server greylisting (new sender suspicion)
- Temporary deferrals at high-volume recipients (Gmail, Outlook)
Delay Remediation
- Bursting â Spread sends over time with batch delays (1,000/batch, 60s between)
- Greylisting â Expected for new domains, resolves as reputation builds
- Rate limit â Request MaxSendRate increase via AWS Console
- Persistent delays to specific providers â Check if that provider is rate-limiting your IP/domain
Correlating Multiple Issues
Problems are often related. Common patterns:
Pattern: Bad import cascade
- Imported unvalidated email list â High bounce rate â SES suppression list grows â Account enters probation
- Fix: Clean list, remove suppressions from bad import, validate before importing
Pattern: Missing authentication cascade
- No DMARC or DMARC=none â Emails hit spam â Users don’t see unsubscribe â They mark as spam â Complaint rate rises â Account reputation drops
- Fix: Set DMARC to quarantine/reject, add visible unsubscribe, clean complaint-sourced suppressions
Pattern: New domain cold start
- New domain + high volume immediately â Greylisting + spam placement â Low engagement â Poor reputation â More spam placement
- Fix: Follow warming schedule, start with engaged users, prioritize transactional emails
When reporting findings, always note if multiple issues are related and prioritize the root cause fix.