Why Inbound Email?
Most email infrastructure focuses on sending. But receiving emails opens up powerful automation possibilities. Instead of building custom SMTP servers or relying on third-party services that store your data, you can process emails directly in your AWS account.
With Wraps inbound email, you get SES, S3, Lambda, and EventBridge working together. Your data never leaves your AWS account.
What Can You Build?
Support Inbox
Auto-create tickets from customer emails. Route by subject, extract order IDs, assign to teams.
Order Processing
Parse confirmations, extract tracking numbers, update databases automatically.
Email-to-Ticket
Integrate with Jira, Linear, GitHub Issues via webhooks.
Auto-Responders
Send acknowledgments, out-of-office, or follow-up sequences.
Lead Capture
Extract contact info from inquiries, sync to CRM.
Document Processing
Extract attachments, process PDFs, trigger workflows.
How It Works
When an email arrives at your domain, AWS SES receives it via MX records, stores the raw message in S3, and triggers a Lambda function. The Lambda parses headers, body, and attachments, then publishes a structured event to EventBridge for your webhooks.
Inbound Email Pipeline
Email arrives at your MX records
Spam Detection
SES scans all incoming mail. spamVerdict tells you if it passed.
Virus Scanning
Attachments are scanned automatically. virusVerdict included in parsed email.
Attachment Storage
Raw attachments stored in S3. Download via SDK when needed.
Threading Support
Reply with proper In-Reply-To headers to maintain email chains.
Getting Started
Deploy inbound infrastructure with one command. The CLI sets up everything: S3 bucket, SES receipt rules, Lambda processor, and EventBridge rules.
npx @wraps.dev/cli email inbound initWhat Gets Deployed
- S3 bucket for raw email storage
- SES Receipt Rule Set and Rules
- Lambda function for email parsing
- EventBridge rule for webhooks
- IAM policies with least-privilege access
See It In Action
◐ Validating AWS credentials...✓ AWS credentials valid (account: 123456789012)◐ Deploying inbound infrastructure... ✓ S3 Bucket: wraps-inbound-emails ✓ SES Receipt Rule Set ✓ SES Receipt Rule ✓ Lambda: wraps-inbound-processor ✓ EventBridge Rule: wraps-inbound-events ✓ IAM Policies configured✓ Inbound infrastructure deployed!MX Record: 10 inbound-smtp.us-east-1.amazonaws.comNext: Add the MX record to your DNSConfigure Your DNS
After deployment, add the MX record to your domain's DNS. This routes incoming mail to AWS SES.
Type: MX
Name: @ (or subdomain like "inbound")
Value: 10 inbound-smtp.us-east-1.amazonaws.com
TTL: 3600Check Status
Verify your inbound setup is working correctly:
npx @wraps.dev/cli email inbound statusParsed Email Structure
Every inbound email is parsed into a structured JSON object. You get clean access to headers, body (HTML and text), attachments, and spam/virus verdicts.
{
"emailId": "inb_a1b2c3d4",
"receivedAt": "2024-01-15T10:30:00Z",
"from": {
"address": "customer@example.com",
"name": "John Doe"
},
"to": [{ "address": "support@yourapp.com" }],
"subject": "Order #12345 Question",
"html": "<p>Hi, I have a question...</p>",
"text": "Hi, I have a question...",
"attachments": [{
"id": "att_xyz789",
"filename": "receipt.pdf",
"contentType": "application/pdf",
"size": 45678
}],
"spamVerdict": "PASS",
"virusVerdict": "PASS"
}SDK Examples
Install the SDK to interact with your inbox programmatically:
npm install @wraps.dev/emailThe SDK provides methods for listing emails, getting full details, replying with proper threading, and forwarding to team members.
import { WrapsEmail } from '@wraps.dev/email';
const email = new WrapsEmail({
inboundBucket: 'your-bucket-name',
});
// List recent inbound emails
const { emails, cursor } = await email.inbox.list({
limit: 20,
from: 'customer@example.com', // optional
});
for (const msg of emails) {
console.log(`${msg.from.address}: ${msg.subject}`);
}// Get full email details
const inbound = await email.inbox.get('inb_a1b2c3d4');
console.log('From:', inbound.from.name);
console.log('Subject:', inbound.subject);
console.log('HTML:', inbound.html);
// Access attachments
for (const att of inbound.attachments) {
console.log(`${att.filename} (${att.size} bytes)`);
}
// Check spam verdict
if (inbound.spamVerdict === 'PASS') {
// Safe to process
}// Reply with proper threading headers
await email.inbox.reply('inb_a1b2c3d4', {
from: 'support@yourapp.com',
html: `
<p>Thanks for reaching out!</p>
<p>We'll respond within 24 hours.</p>
`,
});
// Threading headers (In-Reply-To, References)
// are automatically set// Forward to your team
await email.inbox.forward('inb_a1b2c3d4', {
to: 'team@yourcompany.com',
from: 'forwarding@yourapp.com',
note: 'Please review this inquiry.',
});
// Original message and attachments preserved// EventBridge Lambda handler
export const handler = async (event) => {
const email = event.detail;
// Route based on recipient
if (email.to[0].address.startsWith('support@')) {
await createSupportTicket(email);
}
// Process attachments
if (email.attachments.length > 0) {
await processAttachments(email);
}
return { statusCode: 200 };
};EventBridge Webhooks
Every incoming email triggers an EventBridge event. Create rules to route emails to Lambda functions, Step Functions, API destinations, or any AWS service.
// EventBridge event detail structure
{
"source": "wraps.inbound",
"detail-type": "Email Received",
"detail": {
"emailId": "inb_a1b2c3d4",
"from": { "address": "customer@example.com" },
"to": [{ "address": "support@yourapp.com" }],
"subject": "Order Question",
"spamVerdict": "PASS",
"virusVerdict": "PASS"
}
}Example: Route to Different Handlers
// Create EventBridge rules for different recipients
// support@yourapp.com -> Support Lambda
// sales@yourapp.com -> Sales Lambda
// billing@yourapp.com -> Billing Lambda
// Each Lambda receives the parsed email
// and can take action (create ticket, notify team, etc.)Continue Learning
Ready to receive emails?
Deploy inbound infrastructure to your AWS account in minutes. Build support inboxes, automate workflows, and own your data.

