Skip to content

romaintb/mel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Mel - Next-Gen TUI Email Client

A modern terminal-based email client that combines the efficiency of CLI tools with the polish of contemporary TUI applications. Built with Go and Bubble Tea, designed for developers and power users who live in terminal environments.

🎯 Product Vision

Mel delivers the resource efficiency and keyboard-driven speed that power users crave, while maintaining the familiar interaction patterns of modern development tools like neovim and lazygit.

✨ Key Features

Navigation & Layout

  • Left Sidebar: Dynamic mail folder tree with real-time unread counts and sync status
  • Mail Folders: Automatically scans ~/Mail directory for actual email folders
  • Thread List: Gmail-style conversation view with subject, participants, and timestamps
  • Thread View: Continuous conversation flow with smart collapsing
  • Modal Interface: Neovim-inspired modal operations (Normal/Insert/Visual/Search)

Search & Discovery

  • Telescope Integration: Two-pane search with results list and live preview
  • Content Search (<leader>fg): Full-text search across all emails
  • Sender Search (<leader>fs): Find emails from specific people/addresses
  • Global Email Search (<leader>fe): Fuzzy search across subjects, senders, dates

Threading & Conversations

  • Gmail-Style Threading: Single conversation flow with smart collapsing
  • Thread Actions: Archive, delete, star, mark read/unread
  • Smart Navigation: j/k between emails, n/p between threads

External Tool Integration

  • Email Sync: mbsync/offlineimap for IMAP synchronization
  • Search & Indexing: notmuch for search and threading support
  • Sending: msmtp/sendmail for SMTP operations

πŸš€ Getting Started

Prerequisites

Mel requires Go and these external tools to be installed and configured:

  • Go β‰₯ 1.22 (to build; verify with go version)
  • mbsync or offlineimap for email synchronization
  • notmuch for search and threading
  • msmtp or sendmail for sending emails

Installation

# Clone the repository
git clone https://github.com/romaintb/mel.git
cd mel

# Build the application
make build

# Run mel
./cmd/mel/mel

Configuration

Mel automatically detects your email setup and works with standard configurations:

  • Maildir: ~/Mail (configurable)
  • Config: ~/.config/mel/config.yaml (auto-generated with defaults)

Mail Folder Setup

Mel automatically scans your mail directory for folders and displays them in the sidebar:

  1. Configure mbsync to sync emails to ~/Mail (or your preferred directory)
  2. Run mbsync to download your email folders
  3. Mel will automatically detect and display all folders with unread counts
  4. Special folders (INBOX, Sent, Drafts, Trash, etc.) are automatically recognized and sorted first
  5. Maildir storage folders (cur, new, tmp) are automatically filtered out and not displayed
  6. Press r in the sidebar to refresh the folder list
  7. Smart scrolling automatically handles long folder lists within the available screen height
  8. Text truncation ensures long folder names never wrap to multiple lines
  9. Optimized sidebar width (40 characters) provides more space for folder names

Example mbsync configuration:

# ~/.mbsyncrc
IMAPAccount gmail
Host imap.gmail.com
User your-email@gmail.com
PassCmd "pass show email/gmail"
SSLType IMAPS

IMAPStore gmail-remote
Account gmail

MaildirStore gmail-local
Path ~/Mail/Gmail/
Inbox ~/Mail/Gmail/INBOX

Channel gmail
Master :gmail-remote:
Slave :gmail-local:
Create Slave
Sync All

Icon Modes

Mel supports two icon display modes:

  • ASCII Mode (default): Uses single-character ASCII art icons for compatibility with all terminals
  • Emoji Mode: Uses colorful emoji icons for better visual appeal

Toggle between modes with <leader>i or configure the default in your config file:`

ui:
  icon_mode: "ascii"  # or "emoji"

⌨️ Keybindings

Normal Mode

  • h/l - Navigate between sidebar and content
  • j/k - Navigate folders and actions in sidebar (with smart scrolling)
  • n/p - Next/previous unread thread
  • o - Expand/collapse thread
  • a - Archive thread
  • d - Delete thread
  • s - Star/unstar thread
  • r - Mark as read / Refresh folders in sidebar
  • u - Mark as unread
  • e - Toggle sidebar
  • i - Enter insert mode
  • v - Enter visual mode
  • / - Enter search mode
  • enter - Select folder or action in sidebar

Search Mode

  • <leader>fg - Content search
  • <leader>fs - Sender search
  • <leader>fe - Global search
  • esc - Exit search mode

Leader Key

  • <space> - Show available commands
  • <space>e - Toggle sidebar
  • <space>i - Toggle icon mode (emoji/ascii)

πŸ—οΈ Architecture

Mel follows a delegation model where external tools handle the heavy lifting:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Mel        β”‚    β”‚   External      β”‚    β”‚   Email        β”‚
β”‚   (TUI/UX)     │◄──►│     Tools       │◄──►│   Servers      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                       β”‚
        β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚              β”‚                 β”‚
        β”‚           mbsync          notmuch
        β”‚        (IMAP sync)      (search/index)
        β”‚
        └──────────────┐
                       β”‚
                   msmtp
                (SMTP send)

Core Components

  • Email Manager: Coordinates external tool operations
  • Search Service: Implements Telescope-style search with relevance scoring
  • UI Components: Modal interface with neovim-inspired interactions
  • Configuration: Auto-detection with sensible defaults

πŸ“Š Performance Targets

  • Memory Usage: < 100MB runtime footprint
  • Startup Time: < 500ms cold start
  • Response Time: < 100ms for all UI interactions
  • Search Speed: Instant results for indexed content

πŸ”§ Development

Building

make build          # Build the application
make test           # Run tests
make clean          # Clean build artifacts

Project Structure

internal/
β”œβ”€β”€ app/           # Main application logic
β”œβ”€β”€ config/        # Configuration management
β”œβ”€β”€ email/         # Email data models and external tool integration
β”œβ”€β”€ icons/         # Icon service with emoji/ASCII mode support
β”œβ”€β”€ search/        # Search service with relevance scoring
└── ui/            # TUI components and modal interface

External Tool Integration

  • mbsync: Email synchronization via IMAP
  • notmuch: Search, indexing, and threading
  • msmtp: SMTP sending operations

Security note: Avoid storing SMTP/IMAP passwords in plain text. Prefer OAuth2 or OS keychain helpers (e.g., pass, GNOME Keyring, macOS Keychain) and restrict file permissions on config files.

🎨 Design Philosophy

  • Familiar Efficiency: Keyboard shortcuts that feel natural to neovim/lazygit users
  • Hybrid Interaction: Mouse support for discoverability, keyboard shortcuts for speed
  • Conversation-First: Gmail-style threading as the default email paradigm
  • Resource Conscious: Sub-100MB memory footprint, instant startup, snappy interactions

πŸ“ˆ Roadmap

Phase 1: Core Foundation βœ…

  • Basic TUI framework with Bubble Tea
  • External tool integration structure
  • Modal interface implementation
  • Email data models

Phase 2: Search & Navigation 🚧

  • Search service architecture
  • Basic keybindings
  • Complete search implementation
  • Thread conversation view

Phase 3: Polish & Composition πŸ“‹

  • Compose interface with context
  • Mouse support integration
  • Visual polish and status indicators

Phase 4: Advanced Features πŸ“‹

  • Smart threading improvements
  • Performance optimizations
  • Extended external tool support

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines and ensure your code follows our standards:

  • All Go code must pass gofmt, go vet, and staticcheck
  • Follow Go best practices and idioms
  • Maintain the PRD-driven architecture
  • Add tests for new functionality

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by the efficiency of aerc and the polish of modern TUI tools
  • Built with Bubble Tea for excellent TUI support
  • Designed for the neovim/lazygit user experience

About

TUI e-mail client written in Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published