How mhibrizif/zimail works
Zimail is a self-hosted, multi-domain email service with a browser client and REST, CLI, and MCP access. A user signs in, opens a mailbox or conversation, and can reply or compose; the mail API delegates sending and persistence to the outbound flow, while inbound provider delivery enters separately and is stored for mailbox retrieval. Supporting product stages include account/domain setup, attachments, calendar and reservation booking, meetings, and scheduled delivery. The README documents these capabilities; unsampled subsystems are represented at their enclosing source directories, without asserting internal call wiring.
Main entry points: index.ts Mail store · mail/+server.ts Mail API · setup/+server.ts Setup and auth API · outbox.ts Outbound dispatch
Components 24
Web application
- Mailbox and pages
src/routes/inbox/+page.server.ts - Mail API
src/routes/api/mail/+server.ts - Conversation API
src/routes/api/mail/[id]/+server.ts
Mail handling
- Mail store
src/lib/server/mail-store/index.ts - Outbound dispatch
src/lib/server/outbound/outbox.ts - Inbound handling
src/lib/server/inbound/inbound.ts - Mail provider adapters
src/lib/server/providers/resend-provider.ts - Attachment handling
src/lib/server/attachments.ts - Scheduled delivery
src/lib/server/scheduled-send.ts - D1 mail and account data
- R2 attachments
Accounts and domains
- Setup and auth API
src/routes/api/setup/+server.ts - Authentication service
src/lib/server/auth/index.ts - Domain API
src/routes/api/domains/+server.ts - Domain service
src/lib/server/domains/index.ts
Calendar and meetings
- Calendar and reservations
src/lib/server/calendar - Meetings
src/lib/server/meet
External interfaces
- CLI and MCP
cli/main.ts - REST API
src/routes/api
Other components
- Mailbox user
- Email delivery service
- Scheduled trigger
- LiveKit
- External iCal feeds
Connections 26
- Mailbox user → Mailbox and pages: uses
- Mailbox and pages → Mail API: requests mail
- Mail API → Mail store: lists mailbox
- Conversation API → Mail store: loads and updates
- Mail API → Outbound dispatch: dispatches send
- Conversation API → Outbound dispatch: dispatches reply
- Outbound dispatch → Mail provider adapters: sends through
- Mail provider adapters → Email delivery service: sends mail
- Email delivery service → Inbound handling: delivers mail
- Inbound handling → Mail store: stores messages
- Mail store → D1 mail and account data: reads and writes
- Attachment handling → R2 attachments: stores files
- Mailbox user → Setup and auth API: sets up account
- Setup and auth API → Authentication service: creates admin and session
- Setup and auth API → Domain service: connects domain and address
- Authentication service → D1 mail and account data: persists identity
- Domain API → Domain service: manages domains
- Domain service → D1 mail and account data: reads and writes
- Mailbox user → REST API: uses
- CLI and MCP → REST API: calls API
- Mailbox user → Calendar and reservations: books and manages events
- Calendar and reservations → External iCal feeds: fetches feeds
- Mailbox user → Meetings: joins meetings
- Meetings → LiveKit: connects calls
- Scheduled trigger → Scheduled delivery: triggers delivery
- Scheduled delivery → Mail provider adapters: releases queued mail