Skip to content

Commit 7b3180c

Browse files
committed
docs: add comprehensive IMAP Proxy documentation to CLAUDE.md
- Add /lib/imapproxy to Project Structure - Add dedicated IMAP Proxy subsection with: - Purpose (OAuth2 abstraction for legacy IMAP clients) - How it works (3-step pass-through proxy) - Authentication methods (global password, access tokens) - Configuration options (settings and environment variables) - Key files (imap-server.js, imap-core/) - Limitations (API-only accounts not supported)
1 parent d63dacb commit 7b3180c

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

CLAUDE.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ EmailEngine is an email sync platform that provides REST API access to email acc
1414
- `/lib/ui-routes` - Web UI route handlers
1515
- `/lib/lua` - Redis Lua scripts for atomic operations
1616
- `/lib/oauth` - OAuth provider implementations
17+
- `/lib/imapproxy` - IMAP proxy server implementation
1718
- `/workers` - Worker thread modules (7 worker types, see Workers section)
1819
- `/test` - Unit and integration tests
1920
- `/config` - TOML configuration files
@@ -73,7 +74,7 @@ EmailEngine uses Node.js Worker Threads for isolated execution. Workers communic
7374
| Submit | `submit.js` | 1* | Processes queued emails for SMTP submission |
7475
| Documents | `documents.js` | 1 | **Deprecated.** Indexes emails in Elasticsearch (legacy feature) |
7576
| SMTP | `smtp.js` | 1 | Optional SMTP server for local email submission (port 2525) |
76-
| IMAP Proxy | `imap-proxy.js` | 1 | Optional IMAP proxy server for local IMAP access (port 2993) |
77+
| IMAP Proxy | `imap-proxy.js` | 1 | Optional IMAP proxy server (see IMAP Proxy section below) |
7778

7879
*Configurable via environment variables (`EENGINE_WORKERS`, `EENGINE_WORKERS_WEBHOOKS`, `EENGINE_WORKERS_SUBMIT`)
7980

@@ -83,6 +84,34 @@ EmailEngine uses Node.js Worker Threads for isolated execution. Workers communic
8384
- Workers auto-restart on crash; accounts are reassigned to available workers
8485
- BullMQ queues distribute jobs to webhooks, submit, and documents workers
8586

87+
### IMAP Proxy
88+
89+
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.
90+
91+
**How it works:**
92+
1. Client connects and authenticates with account ID + password/token
93+
2. Proxy validates credentials and establishes connection to real mail server
94+
3. After auth, all IMAP commands pass through transparently to backend
95+
96+
**Authentication methods:**
97+
- Global password: Configure `imapProxyServerPassword` setting
98+
- Access tokens: 64-character hex token with `imap-proxy` or `*` scope
99+
100+
**Configuration** (settings or environment variables):
101+
- `imapProxyServerEnabled` / `EENGINE_IMAP_PROXY_ENABLED` - Enable the proxy
102+
- `imapProxyServerPort` / `EENGINE_IMAP_PROXY_PORT` - Listen port (default: 2993)
103+
- `imapProxyServerHost` / `EENGINE_IMAP_PROXY_HOST` - Bind address
104+
- `imapProxyServerTLSEnabled` - Enable TLS encryption
105+
- `imapProxyServerProxy` - Enable PROXY protocol (HAProxy)
106+
107+
**Key files:**
108+
- `lib/imapproxy/imap-server.js` - Main proxy server and authentication logic
109+
- `lib/imapproxy/imap-core/` - IMAP protocol implementation (RFC 3501)
110+
111+
**Limitations:**
112+
- Does not work with API-only accounts (e.g., Mail.ru API mode)
113+
- Requires IMAP support on the email provider
114+
86115
## Architecture Notes
87116

88117
- **Multi-threaded**: 7 worker types (API, IMAP, webhooks, submit, documents, SMTP server, IMAP proxy)

0 commit comments

Comments
 (0)