Skip to content

Commit 5421a14

Browse files
committed
docs: add comprehensive SMTP Server documentation to CLAUDE.md
- Add dedicated SMTP Server subsection with: - Purpose (MSA for legacy applications) - How it works (4-step submission flow) - Authentication methods (global password, tokens, or header-based) - Configuration options (settings and environment variables) - Special headers (X-EE-Account, X-EE-Idempotency-Key) - Limitations (25MB max, async delivery, account requirements) - Update workers table to reference SMTP Server section
1 parent 7b3180c commit 5421a14

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

CLAUDE.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ EmailEngine uses Node.js Worker Threads for isolated execution. Workers communic
7373
| Webhooks | `webhooks.js` | 1* | Delivers webhook notifications for email events |
7474
| Submit | `submit.js` | 1* | Processes queued emails for SMTP submission |
7575
| Documents | `documents.js` | 1 | **Deprecated.** Indexes emails in Elasticsearch (legacy feature) |
76-
| SMTP | `smtp.js` | 1 | Optional SMTP server for local email submission (port 2525) |
76+
| SMTP | `smtp.js` | 1 | Optional SMTP server (see SMTP Server section below) |
7777
| IMAP Proxy | `imap-proxy.js` | 1 | Optional IMAP proxy server (see IMAP Proxy section below) |
7878

7979
*Configurable via environment variables (`EENGINE_WORKERS`, `EENGINE_WORKERS_WEBHOOKS`, `EENGINE_WORKERS_SUBMIT`)
@@ -84,6 +84,40 @@ EmailEngine uses Node.js Worker Threads for isolated execution. Workers communic
8484
- Workers auto-restart on crash; accounts are reassigned to available workers
8585
- BullMQ queues distribute jobs to webhooks, submit, and documents workers
8686

87+
### SMTP Server
88+
89+
The SMTP server (`workers/smtp.js`) is a built-in Message Submission Agent (MSA) that allows legacy applications to send emails through EmailEngine using standard SMTP protocol. Messages are queued for asynchronous delivery via the Submit worker.
90+
91+
**How it works:**
92+
1. Client connects and optionally authenticates via SMTP AUTH
93+
2. Client sends message with MAIL FROM, RCPT TO, and DATA commands
94+
3. Server queues message for delivery through the associated EmailEngine account
95+
4. Returns queue ID and scheduled send time
96+
97+
**Authentication methods:**
98+
- With auth enabled (`smtpServerAuthEnabled`):
99+
- Username: Account ID
100+
- Password: Global password (`smtpServerPassword`) or 64-char hex token with `smtp` scope
101+
- Without auth: Specify account via `X-EE-Account` header in message
102+
103+
**Configuration** (settings or environment variables):
104+
- `smtpServerEnabled` / `EENGINE_SMTP_ENABLED` - Enable the server
105+
- `smtpServerPort` / `EENGINE_SMTP_PORT` - Listen port (default: 2525)
106+
- `smtpServerHost` / `EENGINE_SMTP_HOST` - Bind address (default: 127.0.0.1)
107+
- `smtpServerAuthEnabled` - Require SMTP authentication
108+
- `smtpServerPassword` / `EENGINE_SMTP_SECRET` - Global password (encrypted)
109+
- `smtpServerTLSEnabled` - Enable TLS encryption
110+
- `smtpServerProxy` / `EENGINE_SMTP_PROXY` - Enable PROXY protocol (HAProxy)
111+
112+
**Special headers** (removed before sending):
113+
- `X-EE-Account` - Specify sending account (when auth disabled)
114+
- `X-EE-Idempotency-Key` - Prevent duplicate submissions
115+
116+
**Limitations:**
117+
- Max message size: 25MB (configurable via `EENGINE_MAX_SMTP_MESSAGE_SIZE`)
118+
- Asynchronous delivery only (messages queued, not sent immediately)
119+
- Account must have valid SMTP or OAuth2 credentials configured
120+
87121
### IMAP Proxy
88122

89123
The IMAP proxy (`lib/imapproxy/`) allows standard IMAP clients to access EmailEngine-managed accounts. It abstracts OAuth2 complexity, enabling legacy clients to connect to Gmail, Microsoft 365, and other OAuth2-only providers.

0 commit comments

Comments
 (0)