Skip to main content

Welcome to EmailEngine

EmailEngine is a self-hosted email gateway that provides a unified REST API for accessing email accounts through IMAP, SMTP, Gmail API, and Microsoft Graph API. Build email functionality into your application without dealing with the complexity of different email protocols and providers.

What Can You Do With EmailEngine?

Send Emails

Send emails through any email provider with a single API endpoint. EmailEngine handles SMTP connections, OAuth2 authentication, retries, and delivery tracking.

// Send an email with one API call
POST /v1/account/{account}/submit
{
"to": [{"address": "user@example.com"}],
"subject": "Hello from EmailEngine",
"html": "<p>Your message here</p>"
}

Receive Emails in Real-Time

Get instant webhook notifications when new emails arrive, no polling required.

// Webhook payload for new email
{
"event": "messageNew",
"data": {
"id": "AAAAAQAACnA",
"subject": "Re: Meeting tomorrow",
"from": {"address": "client@example.com"},
"text": {"plain": "Thanks for scheduling..."}
}
}

Manage Email Accounts

Register and manage multiple email accounts with automatic connection handling.

// Register an email account with OAuth2
POST /v1/account
{
"account": "user123",
"email": "user@gmail.com",
"oauth2": {
"provider": "AAABlf_0iLgAAAAQ", // OAuth2 app ID from EmailEngine (base64url encoded)
"refreshToken": "1//0gF...", // Refresh token from OAuth2 flow
"auth": {
"user": "user@gmail.com" // Email address (required)
}
}
}

Search and Organize

Search messages, organize mailboxes, manage flags, and download attachments.

Why EmailEngine?

One API for All Providers

  • IMAP/SMTP - Works with any email provider
  • Gmail API - Native Gmail integration with Cloud Pub/Sub
  • Microsoft Graph API - Native Microsoft 365 and Outlook integration
  • Consistent interface across all provider types

Built for SaaS Applications

  • Multi-account - Manage thousands of email accounts
  • OAuth2 support - Built-in OAuth2 for Gmail, Google Workspace, Microsoft 365
  • Webhooks - Real-time notifications for all email events
  • Queue management - Automatic retries and delivery tracking

Production-Ready

  • Self-hosted - Full control over your data and privacy
  • Scalable - Vertical scaling with performance tuning
  • Reliable - Automatic reconnection and error recovery
  • Performant - Efficient connection pooling and caching

Quick Start

Get your first email working in 10 minutes:

  1. Install EmailEngine - Set up with Docker, npm, or on platforms like Render.com
  2. Add Your First Account - Register an email account via API
  3. Send an Email - Submit your first message
  4. Receive Webhooks - Get notified of new emails

Common Use Cases

Email-Integrated SaaS

Build email functionality into your SaaS application:

Email Automation

Automate email workflows:

Customer Support

Integrate email into your support system:

  • Manage multiple support email accounts
  • Track email conversations
  • Send templated responses
  • Explore mail merge →

Email Analytics

Analyze email communications:

  • Track email delivery and opens
  • Generate AI-powered email summaries
  • Monitor email activity across accounts
  • See AI integration →

Architecture Overview

EmailEngine works as a middleware between your application and email providers:

EmailEngine Architecture

How it works:

  1. Your Application - Makes REST API calls to EmailEngine and receives webhook notifications
  2. EmailEngine - Maintains persistent connections to email providers and manages data synchronization
  3. Redis - Stores email metadata, message queues, and account data for fast access
  4. Email Providers - Gmail, Outlook, Microsoft 365, and any IMAP/SMTP server

Data flows:

  • API requests: Your app calls EmailEngine REST API → EmailEngine connects to email providers or retrieves from Redis
  • Webhooks: Email providers send updates → EmailEngine processes → Your app receives webhook notifications
  • Data storage: EmailEngine stores metadata and queues in Redis (email content is not stored, only fetched on demand)

Key features:

  • Unified API for all email providers (IMAP, SMTP, Gmail API, Microsoft Graph API)
  • OAuth2 authentication support for Gmail, Google Workspace, and Microsoft 365
  • Real-time webhooks for instant email notifications
  • Automatic reconnection and error recovery
  • Queue management with automatic retries

API Reference

EmailEngine provides a comprehensive REST API:

Get Help

System Requirements

  • Node.js 20.x or higher
  • Redis Any version (or Redis-compatible service like Upstash)
  • Memory Minimum 2GB RAM (4GB+ recommended for production)
  • OS Linux, macOS, or Windows

License

EmailEngine requires a license key for production use. Get a license:


Next Steps

New to EmailEngine?

  1. Read the introduction to understand what EmailEngine can do
  2. Follow the quick start guide to get your first email working
  3. Set up OAuth2 for Gmail or Outlook

Ready to build?

Need inspiration?