SDK Quickstart
Get started with the Inbound Email SDK in under 5 minutes. This guide will walk you through installation, authentication, sending your first email, and setting up basic email receiving.This quickstart uses the unified email API structure with
inbound.email.*
methods for the best developer experience.Prerequisites
Before you begin, make sure you have:- Node.js 16.0+ installed
- An Inbound account (sign up here)
- Your API key from the dashboard
Step 1: Install the SDK
1
Install the package
Install the official Inbound Email SDK:
The SDK is now installed and ready to use.
2
Set up environment variables
Create a
.env
file in your project root:.env
Never commit API keys to version control. Always use environment variables.
Step 2: Send Your First Email
1
Create the client
Import and initialize the Inbound client:
The client automatically handles authentication and provides a unified interface for all email operations.
2
Send an email
Send your first email using the unified API:
If successful, you’ll see the email ID logged to your console.
You can use
agent@inbnd.dev
as the sender for testing without domain verification.Step 3: Set Up Email Receiving
1
Add your domain
Add a domain to receive emails:
You’ll need to add the returned DNS records to your domain’s DNS configuration.
2
Create a webhook endpoint
Set up a webhook to receive email notifications:
Your webhook endpoint is now ready to receive email notifications.
3
Create an email address
Configure an email address to route emails:
Emails sent to this address will now be forwarded to your webhook.
Step 4: Handle Incoming Emails
Create a webhook handler to process incoming emails:app/api/webhook/route.ts
Complete Example
Here’s a complete example that demonstrates both sending and receiving emails:Key Concepts
Universal Email Management
The SDK provides a unified interface for managing all emails:Use
inbound.email.get(id)
when you’re not sure if an email ID refers to a received or sent email - it automatically detects the type.Response Pattern
All SDK methods use a consistent{ data, error }
response pattern:
React Email Support
The SDK supports React components for email content:Common Operations
Managing Received Emails
Scheduling Emails
Working with Attachments
Error Handling Best Practices
Next Steps
Unified Email Management
Complete guide to managing received and sent emails with the unified API
Email Sending
Advanced email sending features including React templates and scheduling
Webhook Handling
Comprehensive webhook setup and email processing patterns
Configuration
Detailed configuration options and environment setup
Quick Reference
Common Methods
Sending & Scheduling
Sending & Scheduling
Managing Received Emails
Managing Received Emails
Universal Email Access
Universal Email Access
Domain & Configuration
Domain & Configuration
Migration Note: If you’re using deprecated
mail.*
methods, check the Migration Guide for updating to the unified email API.