How postalsys/emailengine works
EmailEngine is a headless email API that normalizes IMAP/SMTP, Gmail, and Microsoft Graph accounts behind REST endpoints. The main workflow is an API or hosted-admin request to connect an account, synchronize it through a provider client, persist state in Redis, and expose mail operations and notifications. Sending, webhooks, export, legacy protocol access, and administration are distinct product branches. Edges are limited to relationships supported by the README or SOURCE INDEX; several runtime wiring details were not sampled.
Main entry points: account.js Account Management · db.js Redis Store and Queues · account-routes.js API Routes · api-listener.js REST API
Components 23
Interfaces
- REST API
lib/api-listener.js - API Routes
lib/api-routes/account-routes.js - Admin Interface
lib/routes-ui.js - Admin Authentication
lib/ui-routes/auth-routes.js
Accounts and Sync
- Account Management
lib/account.js - OAuth Provider Apps
lib/oauth2-apps.js - IMAP Client
lib/email-client/imap-client.js - Gmail Client
lib/email-client/gmail-client.js - Microsoft Graph Client
lib/email-client/outlook-client.js
Mail Delivery
- Webhook Management
lib/webhooks.js - Webhook Delivery Worker
workers/webhooks.js - SMTP Submission
workers/submit.js - Queued Sending
lib/outbox.js - Mail Export
lib/export.js
Operations
- IMAP Proxy
lib/imapproxy/imap-server.js - MCP Integration
lib/mcp/index.js - Metrics and Operations
lib/metrics-collector.js
Shared Foundation
- Redis Store and Queues
lib/db.js - Settings
lib/settings.js - Validation Schemas
lib/schemas.js - API Tokens
lib/tokens.js
Other components
- API Integrator
- Administrator
Connections 20
- API Integrator → REST API: calls
README.md - Administrator → Admin Interface: uses
README.md - REST API → API Routes: routes requests
- Admin Interface → Admin Authentication: authenticates through
lib/routes-ui.js - API Routes → Account Management: manages accounts
lib/api-routes/account-routes.js - Account Management → OAuth Provider Apps: resolves provider
lib/account.js - Account Management → Redis Store and Queues: stores account state
lib/account.js - Account Management → IMAP Client: supports IMAP sync
- Account Management → Gmail Client: supports Gmail sync
- Account Management → Microsoft Graph Client: supports Graph sync
lib/email-client/outlook-client.js - Webhook Delivery Worker → Webhook Management: loads handlers
workers/webhooks.js - Webhook Management → Redis Store and Queues: stores routes
lib/webhooks.js - Queued Sending → Redis Store and Queues: queues delivery
- SMTP Submission → Queued Sending: processes queued mail
- Mail Export → Redis Store and Queues: uses export queue
- IMAP Proxy → Account Management: accesses mail accounts
- MCP Integration → API Tokens: uses API tokens
- Settings → Redis Store and Queues: reads and writes
lib/settings.js - API Tokens → Redis Store and Queues: stores tokens
lib/tokens.js - API Routes → Validation Schemas: validates requests
lib/api-routes/account-routes.js