How berenebot-agent/mm-dirty-wip works
MailMoose is self-hosted email infrastructure for AI agents: users configure domains and inboxes, agents access scoped mailboxes through the API or connectors, inbound mail is stored and emitted as replayable events, and outbound mail is delivered through configured providers. The graph preserves documented webhook, Direct MX, standalone IMAP/SMTP, Web UI, Hermes, OpenClaw, and event-replay capabilities. Several subsystem implementations were not sampled; those nodes use exact directories from the tree, and relationships are included only where the README or cited source supports them.
Main entry points: service.go Mailbox core · hub.go Replayable events · httpapp API and Web UI · store SQLite state
Components 21
Access and mailbox
- API and Web UI
internal/httpapp - Scoped authentication
internal/auth/auth.go - Mailbox core
internal/app/service.go - Standalone mailbox
internal/app/remote_mailbox.go
Mail processing
- IMAP watcher
internal/app/remote_worker.go - Inbound webhooks
internal/app/webhook_worker.go - MIME parsing
internal/mailparse/mailparse.go - Outbound worker
internal/app/worker.go - Mail transports
internal/transport
Durable state
- SQLite state
internal/store - Raw MIME files
internal/store/storage.go
Events and connectors
- Replayable events
internal/events/hub.go - SSE and REST
internal/httpapp - Hermes Relay
internal/hermesrelay/server.go - OpenClaw connector
plugins/openclaw/openclaw-plugin/src/relay.ts
MX receiving edge
- MX receiver
internal/mxagent/server.go - Receiver runtime
dialmx/runtime/runtime.go - MX core handoff
internal/transport/mxdial/runtime.go
Other components
- Administrator
- Agents and services
- Internet email
Connections 29
- Administrator → API and Web UI: configures
README.md - Agents and services → API and Web UI: uses API
README.md - Internet email → Inbound webhooks: sends mail
README.md - Internet email → MX receiver: sends mail
README.md - API and Web UI → Scoped authentication: authenticates
internal/httpapp/server.go - API and Web UI → Mailbox core: routes requests
internal/httpapp/server.go - Scoped authentication → Mailbox core: scopes access
README.md - Mailbox core → SQLite state: persists state
internal/app/service.go - Mailbox core → Replayable events: publishes events
README.md - Inbound webhooks → MIME parsing: parses mail
README.md - Inbound webhooks → SQLite state: deduplicates delivery
README.md - MIME parsing → Mailbox core: ingests mail
README.md - Outbound worker → Mailbox core: delivers queued mail
internal/app/worker.go - Mailbox core → Mail transports: sends through
internal/app/service.go - Standalone mailbox → IMAP watcher: watches inboxes
internal/app/remote_worker.go - IMAP watcher → Replayable events: publishes arrivals
internal/app/remote_worker.go - Replayable events → SQLite state: replays durable history
README.md - Replayable events → SSE and REST: fans out
README.md - Replayable events → Hermes Relay: delivers events
README.md - Replayable events → OpenClaw connector: delivers events
README.md - SSE and REST → Agents and services: serves updates
README.md - Hermes Relay → Agents and services: connects agents
README.md - OpenClaw connector → Agents and services: connects agents
README.md - MX receiver → Receiver runtime: runs receiver
- Receiver runtime → MX receiver: serves SMTP
dialmx/runtime/runtime.go - Mailbox core → MX core handoff: opens MX session
README.md - MX core handoff → MX receiver: hands off mail
README.md - SQLite state → Raw MIME files: stores raw MIME
README.md - Standalone mailbox → Mail transports: uses IMAP and SMTP
README.md