cwmail — terminal email with AI-drafted replies
cwmail
A terminal email client with proper HTML rendering,<br>inline image support, multi-account IMAP, and AI-drafted replies powered<br>by DeepSeek V4 Pro.
Written in Go on Bubbletea v2. Reads real mail. Renders HTML newsletters,<br>receipts, calendar invites, and event posters without dropping out to a<br>browser. Drafts replies you can edit in place.
IMAP
multi-account<br>Gmail, iCloud, Outlook, custom
IDLE
push notifications<br>not polling
AI
DeepSeek V4 Pro<br>drafts your reply
What it is
cwmail is a full-screen Bubbletea TUI for managing IMAP mailboxes. It<br>handles the actual hard parts of email — MIME multipart, HTML rendering,<br>charset detection, inline images, attachments, threading, drafts —<br>not just the obvious ones.
You can manage as many IMAP accounts as you want side-by-side in the<br>sidebar. Folder navigation is fast (Vim-style or arrows), full-text<br>search hits the local SQLite mirror so it returns instantly, and IDLE<br>push keeps your inbox current without polling. Desktop notifications<br>fire when new mail arrives.
The AI-drafted-reply feature is a one-key action: hit R on<br>any open message and the model produces a contextual reply draft in the<br>composer. You can edit, send, save as draft, or discard. Same DeepSeek<br>profile cwcode uses, so one API key powers both apps.
It is not a service. There is no cwmail.io. Your IMAP credentials sit<br>in ~/.config/cwmail/config.json; everything else lives in<br>~/.local/share/cwmail/. Offline-capable for everything<br>except actually sending and fetching.
Why it’s different
Multi-account IMAP
As many Gmail / iCloud / Outlook / custom-IMAP accounts as you want<br>in the sidebar at once. Each account’s folder tree, unread<br>counter, and IDLE connection is independent. The Spam, Trash, and<br>Drafts folders are merged into a unified view by default.
HTML emails that render
Most terminal mail clients dump the plain-text alternative and call<br>it a day. cwmail’s HTML-to-terminal converter handles tables,<br>horizontal & vertical rules, ordered & unordered lists,<br>block quotes, links, charset translation, and HTML entity decoding.<br>Newsletters, receipts, event invites all read cleanly.
Inline images
Embedded and CID-referenced images render as half-block ANSI in<br>24-bit color (via pixterm-style rendering). Works on<br>any terminal with true-color support. Useful for event banners,<br>product photos in receipts, and inline charts.
AI-drafted replies
Hit R on any open message. The DeepSeek V4 Pro model<br>drafts a contextual reply (using the same profile cwcode uses).<br>You see the draft in the composer ready to edit. The model knows<br>the prior thread, your typical tone, and whether to be terse or<br>warm based on the conversation. Costs ~$0.01 per draft.
IDLE push, not polling
IMAP IDLE means the server tells the client when new mail arrives.<br>cwmail keeps one IDLE connection per account open and surfaces new<br>mail within a second of receipt. No 5-minute fetch cycles, no<br>batch checking. Desktop notifications fire on arrival.
Undo delete
Delete moves to Trash and shows a brief “undo” toast<br>for 8 seconds. Hit u and the message comes back.<br>Matches matcha.email’s UX for the most common reflex<br>mistake.
Draft auto-save
Any time you’re editing a reply or compose, the buffer is<br>persisted to ~/.local/share/cwmail/drafts/ every few<br>keystrokes. Crash, force-quit, accidentally close the window<br>— the draft is still there next time you launch.
CLI send mode
cwmail send --to alice@example.com --subject “build done”<br>--body “all green” — non-interactive sending,<br>useful for AI agents (cwcode included), CI pipelines, and shell<br>scripts. Reads body from stdin too. Same auth as the TUI.
No SaaS lock-in
Config is JSON. Local mirror is SQLite. Drafts are plain files<br>under ~/.local/share/cwmail/. You can grep your own<br>mail. Credentials live in the OS keyring (macOS Keychain, libsecret<br>on Linux, Credential Manager on Windows).
What it looks like
Inbox view — multi-account sidebar, dense subject/from/date list, vim-style nav.
HTML newsletter rendered inline — tables, event blocks, and inline images as half-block ANSI.
AI-drafted reply — one keypress, contextual draft, then edit and send.
Install
Download a pre-built binary from the<br>Google Drive release folder<br>(current build: v0.9; macOS arm64 / amd64 and Linux amd64). Drop it<br>somewhere on your PATH and make it executable:
curl -L -o ~/.local/bin/cwmail<br>chmod +x ~/.local/bin/cwmail<br>cwmail --help
Configure your first IMAP account in<br>~/.config/cwmail/config.json:
"accounts": [<br>"name": "Gmail",<br>"imap": "imap.gmail.com:993",<br>"smtp": "smtp.gmail.com:587",<br>"username": "you@gmail.com"<br>],<br>"ai": {<br>"endpoint": "https://api.deepseek.com",<br>"model": "deepseek-v4-pro",<br>"api_key": "sk-..."
Run it.
cwmail # full TUI<br>cwmail send --to a@b.com --subject hi # non-interactive send<br>cwmail compose # straight to composer
On first launch cwmail prompts for the Gmail...