Skip to content

Email Forwarding

mailiam’s email forwarding system allows you to receive emails sent to any address at your domain and forward them to your existing email. This includes both specific address forwarding and catch-all forwarding for unknown addresses.

Configure forwarding for your domain:

Terminal window
curl -X POST https://api.mailiam.dev/forwarding/setup \
-H "Content-Type: application/json" \
-d '{
"domain": "yourdomain.com",
"forwardTo": "your@gmail.com"
}'

Add these MX records to your DNS:

Priority Host Points to
10 yourdomain.com inbound-smtp.us-east-1.amazonaws.com

Test your forwarding:

Terminal window
curl https://api.mailiam.dev/forwarding/yourdomain.com/verify

That’s it! Emails sent to any address at your domain will now forward to your specified email.

Forward all emails to your domain to a single address:

Terminal window
curl -X POST https://api.mailiam.dev/forwarding/domains \
-H "Content-Type: application/json" \
-d '{
"domain": "company.com",
"type": "catch-all",
"forwardTo": "team@company.com"
}'

Use Cases:

  • Small businesses wanting to catch all customer emails
  • Personal domains where you want everything in one inbox
  • Temporary projects needing simple email setup

Forward specific email addresses to different destinations:

Terminal window
curl -X POST https://api.mailiam.dev/forwarding/addresses \
-H "Content-Type: application/json" \
-d '{
"address": "support@company.com",
"forwardTo": "help-desk@company.com"
}'

Use Cases:

  • Department-specific routing (sales@, support@, info@)
  • Employee email aliases
  • Legacy address migration

Forward one address to multiple recipients:

Terminal window
curl -X POST https://api.mailiam.dev/forwarding/addresses \
-H "Content-Type: application/json" \
-d '{
"address": "alerts@company.com",
"forwardTo": ["admin@company.com", "ops@company.com", "security@company.com"]
}'

Set forwarding priority (specific addresses override catch-all):

Terminal window
# Catch-all setup
curl -X POST https://api.mailiam.dev/forwarding/domains \
-d '{
"domain": "company.com",
"type": "catch-all",
"forwardTo": "general@company.com",
"priority": 1
}'
# Specific address (higher priority)
curl -X POST https://api.mailiam.dev/forwarding/addresses \
-d '{
"address": "ceo@company.com",
"forwardTo": "boss@company.com",
"priority": 10
}'

Forward based on email content or sender:

Terminal window
curl -X POST https://api.mailiam.dev/forwarding/rules \
-H "Content-Type: application/json" \
-d '{
"domain": "company.com",
"conditions": {
"subject_contains": ["urgent", "emergency"],
"sender_domain": "client.com"
},
"forwardTo": "escalation@company.com"
}'

Forward to different addresses based on time:

Terminal window
curl -X POST https://api.mailiam.dev/forwarding/schedules \
-H "Content-Type: application/json" \
-d '{
"address": "support@company.com",
"schedules": [
{
"days": ["monday", "tuesday", "wednesday", "thursday", "friday"],
"hours": "09:00-17:00",
"timezone": "America/New_York",
"forwardTo": "support-team@company.com"
},
{
"days": ["saturday", "sunday"],
"forwardTo": "on-call@company.com"
}
]
}'

All original email headers are preserved:

  • From: Original sender address
  • To: Original destination address
  • Reply-To: Automatically set to original sender
  • Subject: Unchanged (with optional prefix)
  • Message-ID: Original message threading preserved

Add prefixes to forwarded emails:

Terminal window
curl -X PATCH https://api.mailiam.dev/forwarding/addresses/support@company.com \
-d '{
"subjectPrefix": "[SUPPORT] "
}'

Result: [SUPPORT] Customer needs help with product

  • Small Attachments (< 10MB): Forwarded as-is
  • Large Attachments (> 10MB): Stored in S3, link provided in email
  • Suspicious Attachments: Quarantined and notification sent

Built-in spam protection:

  • SPF/DKIM Verification: Checks sender authentication
  • Content Filtering: Scans for spam patterns
  • Reputation Filtering: Blocks known spam sources
  • Rate Limiting: Prevents forwarding abuse
Terminal window
curl -H "Authorization: Bearer your-token" \
https://api.mailiam.dev/forwarding/rules
Terminal window
curl -X PATCH https://api.mailiam.dev/forwarding/addresses/info@company.com \
-d '{
"forwardTo": "new-address@company.com"
}'

Temporarily disable without deleting:

Terminal window
curl -X PATCH https://api.mailiam.dev/forwarding/addresses/temp@company.com \
-d '{
"enabled": false
}'
Terminal window
curl -X DELETE https://api.mailiam.dev/forwarding/addresses/old@company.com

Add these records to your DNS provider:

Type Name Value Priority
MX yourdomain.com inbound-smtp.us-east-1.amazonaws.com 10
MX yourdomain.com inbound-smtp.us-west-2.amazonaws.com 20

Improve deliverability with these optional records:

Type Name Value
TXT yourdomain.com v=spf1 include:mailiam.dev ~all
TXT _dmarc v=DMARC1; p=none; rua=mailto:admin@yourdomain.com

Forward emails from subdomains:

Type Name Value
MX mail.yourdomain.com inbound-smtp.us-east-1.amazonaws.com

Gradually migrate from Google Workspace:

Terminal window
# Set up catch-all for unmigrated users
curl -X POST https://api.mailiam.dev/forwarding/domains \
-d '{
"domain": "company.com",
"type": "catch-all",
"forwardTo": "team@company.gmail.com"
}'
# Migrate specific users
curl -X POST https://api.mailiam.dev/forwarding/addresses \
-d '{
"address": "john@company.com",
"forwardTo": "john.smith@company.gmail.com"
}'

Route customer emails by department:

Terminal window
# General support
curl -X POST https://api.mailiam.dev/forwarding/addresses \
-d '{
"address": "support@company.com",
"forwardTo": ["tier1@company.com", "manager@company.com"]
}'
# Sales inquiries
curl -X POST https://api.mailiam.dev/forwarding/addresses \
-d '{
"address": "sales@company.com",
"forwardTo": "sales-team@company.com"
}'
# Catch remaining emails
curl -X POST https://api.mailiam.dev/forwarding/domains \
-d '{
"domain": "company.com",
"type": "catch-all",
"forwardTo": "general@company.com"
}'

Forward emails by environment:

Terminal window
# Production emails
curl -X POST https://api.mailiam.dev/forwarding/domains \
-d '{
"domain": "app.com",
"forwardTo": "alerts@company.com"
}'
# Staging emails
curl -X POST https://api.mailiam.dev/forwarding/domains \
-d '{
"domain": "staging.app.com",
"forwardTo": "dev-team@company.com"
}'

View forwarding metrics:

Terminal window
curl -H "Authorization: Bearer your-token" \
https://api.mailiam.dev/forwarding/stats?domain=company.com

Response:

{
"domain": "company.com",
"period": "last_30_days",
"emails_forwarded": 1250,
"emails_blocked": 45,
"top_senders": [
{"address": "support@client.com", "count": 120},
{"address": "noreply@service.com", "count": 89}
],
"forwarding_breakdown": {
"catch_all": 800,
"specific_addresses": 450
}
}

Set up webhooks for forwarding events:

Terminal window
curl -X POST https://api.mailiam.dev/forwarding/webhooks \
-d '{
"url": "https://your-app.com/webhook",
"events": ["email.forwarded", "email.blocked", "rule.matched"]
}'

Emails not being forwarded?

  1. Check MX records are correctly set
  2. Verify forwarding rules are active
  3. Check spam folder of destination email
  4. Ensure domain verification is complete

Some emails missing?

  1. Check for content-based filtering rules
  2. Review spam protection settings
  3. Verify attachment size limits
  4. Check forwarding quotas

Forwarding delayed?

  1. Email forwarding is typically < 5 seconds
  2. Large attachments may cause delays
  3. Recipient server issues can cause delays
  4. Check AWS SES service status
  • Use API keys for authentication
  • Rotate keys regularly
  • Implement IP whitelisting for sensitive domains
  • Monitor forwarding logs for suspicious activity
  • Enable SPF/DKIM checking
  • Use DMARC policies
  • Block emails from suspicious domains
  • Implement rate limiting
  • All emails are encrypted in transit
  • Temporary email storage is encrypted
  • Attachments are virus-scanned
  • Personal data is automatically purged