Overview
The unified email API consolidates all email operations underinbound.email.*
. This guide helps you migrate from the deprecated mail.*
methods to the new structure.
No Rush: All existing
mail.*
methods continue to work with console warnings. Migration is recommended for cleaner code and future compatibility.Quick Migration Reference
Core Methods
Old (Deprecated) | New (Recommended) | Universal Alternative |
---|---|---|
inbound.mail.list() | inbound.email.received.list() | - |
inbound.mail.get(id) | inbound.email.received.get(id) | inbound.email.get(id) |
inbound.mail.thread(id) | inbound.email.received.thread(id) | - |
inbound.mail.markRead(id) | inbound.email.received.markRead(id) | - |
inbound.mail.markUnread(id) | inbound.email.received.markUnread(id) | - |
inbound.mail.archive(id) | inbound.email.received.archive(id) | - |
inbound.mail.unarchive(id) | inbound.email.received.unarchive(id) | - |
inbound.mail.reply(params) | inbound.email.received.reply(params) | - |
inbound.mail.bulk(ids, updates) | inbound.email.received.bulk(ids, updates) | - |
Sent Email Methods
Old (Deprecated) | New (Recommended) |
---|---|
inbound.email.get(id) | inbound.email.sent.get(id) |
inbound.email.reply(id, params) | inbound.email.sent.reply(id, params) |
inbound.email.listScheduled() | inbound.email.sent.listScheduled() |
inbound.email.getScheduled(id) | inbound.email.sent.getScheduled(id) |
inbound.email.cancel(id) | inbound.email.sent.cancel(id) |
Step-by-Step Migration
Step 1: Update Imports (No Change Required)
Step 2: Replace mail.* Methods
Step 3: Use Universal Email Access
Migration Examples
Webhook Handler Migration
Email Processing Pipeline
Bulk Operations
Gradual Migration Strategy
Phase 1: No Changes Required
- All existing code continues to work
- Console warnings will appear for deprecated methods
- No immediate action needed
Phase 2: Update New Code
- Use new unified API for all new features
- Get familiar with the new structure
- Test the universal
email.get()
method
Phase 3: Migrate Critical Paths
- Update high-traffic webhook handlers first
- Migrate core email processing logic
- Update automated systems
Phase 4: Complete Migration
- Replace all remaining
mail.*
calls - Remove deprecated method usage
- Prepare for v6.0.0 when
mail.*
will be removed
Testing Your Migration
Verify Functionality
Side-by-Side Comparison
Common Migration Issues
Issue 1: Email Not Found Errors
Problem:inbound.email.get()
only worked for sent emails in older versions.
Issue 2: Confusion About Email Types
Problem: Not sure if an email ID belongs to received or sent emails.Issue 3: TypeScript Type Issues
Problem: Type conflicts when migrating.Next Steps
- Start with Universal Methods: Use
inbound.email.get()
for new code - Migrate High-Impact Code: Focus on webhook handlers and core logic first
- Test Thoroughly: Verify all functionality works as expected
- Monitor Warnings: Watch console output for deprecated method usage
- Plan for v6.0.0: Prepare for removal of
mail.*
methods