A fast and minimal terminal-based email client built in Go. Inspired by tools like mutt, aerc, and himalaya.
This project demonstrates clean architecture, form-based input, SMTP/IMAP support, and async operations using Go + TUI (tview).
gomail.mp4
- 📥 View Inbox (via file store or real IMAP)
- 📝 Compose & send real emails via SMTP
- 🚗 Dual-mode backend: file or real email provider (Gmail, Outlook, etc.)
- 🗑️ Delete email (file-based only)
- ❌ ESC/back navigation from all views
- ✅ Email validation and success messages
- 📃 Logs written to
logs.txt(resets each run) - 🐳 Docker support
- 🧼 Clean, modular code structure
Enable real email capabilities with Gmail, Outlook, Fastmail, etc. (via App Passwords or standard login).
USE_REAL_EMAIL=true
EMAIL_IMAP_HOST=imap.gmail.com
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=587
EMAIL_IMAP_PORT=993
EMAIL_USER=your@email.com
EMAIL_PASS=your-app-password
NUMBER_OF_EMAIL_TO_FETCH=5
⚠️ Use App Password for Gmail (NOT your real password!)
go-email-client/
├── cmd/
│ └── main.go # Application entry point (CLI)
├── internal/
│ ├── domain/
│ │ ├── model/
│ │ │ └── email.go # Core domain model for emails
│ │ └── service/
│ │ └── email_service.go # Business logic for email operations
│ ├── infra/
│ │ └── logger/
│ │ └── logger.go # Centralized logging configuration
│ ├── interface/
│ │ ├── controller/
│ │ │ └── handler.go # Application-layer request handling
│ │ ├── persistence/
│ │ │ ├── file_store.go # File-based storage implementation
│ │ │ └── imap_smtp_store.go # IMAP/SMTP backend implementation
│ │ └── ui/
│ │ └── app.go # Terminal UI (TUI) using tview
│ └── utils/
│ └── utils.go # Shared utility functions
├── web/
│ ├── static/
│ │ └── index.html # Web-based terminal (xterm.js)
│ └── main.go # WebSocket and PTY server
├── .env.example # Sample environment configuration
├── .gitignore # Git ignored files and directories
├── Dockerfile # Docker multi-stage build config
├── emails.json # Sample local email data store
├── go.mod # Go module definition
├── logs.txt # Log output file
├── Makefile # Build and development commands
└── README.md # Project documentation
- Go 1.21+
- Docker (optional)
make(for simplified workflows)
🔹 Run Terminal-Only App
go run cmd/main.go # terminal-only UI🔹 Run Web-Based Terminal UI
go build -o email-client ./cmd # build CLI binary
go run ./web # run web interface🔹 Or Use the Makefile (Recommended)
make build && make runVisit: http://localhost:8080
make docker-build # builds WebSocket + CLI
make docker-run # launches container on port 8080
make clean # removes built binariesVisit: http://localhost:8080
i→ 📥 Open Inboxc→ 📝 Compose Emaild→ 🗑️ Delete EmailESC→ BackTab/Shift+Tab→ Move between form fields
- Fake local store:
file_store.go - Real backend (SMTP/IMAP):
imap_smtp_store.go
Switch between them via USE_REAL_EMAIL in .env
MIT License. Use it, share it, build on it — but don’t send spam 😏