Guide
Email CLI Tools Compared
Compare seven email CLI tools for developer workflows: Nylas CLI, Himalaya, aerc, NeoMutt, msmtp, mailx, and swaks. Covers OAuth, JSON output, send without SMTP or Postfix, provider coverage, calendar access, and AI agent integration.
Written by Caleb Geene Director, Site Reliability Engineering
Reviewed by Hazik
Disclosure: Nylas CLI is built by Nylas, the publisher of this guide. We have aimed to present an honest comparison, but readers should be aware of this relationship.
What is the best email CLI for developers?
An email CLI is a command-line tool for sending, reading, or managing email from a terminal. Seven tools dominate in 2026: Nylas CLI, Himalaya, aerc, NeoMutt, msmtp, mailx, and swaks. Use a provider API client to send email without configuring SMTP or Postfix. Use a TUI client (aerc, NeoMutt, Himalaya) for interactive reading. Use msmtp or swaks for relay and SMTP testing.
If you are comparing the best command line email client or a command line email client Linux admins can run in scripts, split the category into three jobs: inbox access, message delivery, and SMTP diagnostics.
Each tool occupies a different niche. NeoMutt, aerc, and Himalaya are mail user agents (MUAs) that read and compose mail via IMAP/SMTP. msmtp is a lightweight mail transfer agent (MTA) that relays messages to an SMTP server. Nylas CLI is neither — it is an API client that talks to 6 email providers through the Nylas platform, giving you unified access without configuring SMTP, IMAP, or OAuth manually.
For a command line SMTP client, msmtp and swaks are the right comparison set. For Gmail, Outlook, Exchange, Yahoo, iCloud, or IMAP workflows that need OAuth and JSON output, a provider API CLI like Nylas or a modern Rust/Go client like Himalaya is the better fit.
Nylas CLI
A modern, open-source CLI (MIT licensed) that connects to Gmail, Outlook, Exchange, Yahoo, iCloud, and any IMAP provider through OAuth. Provides email, calendar, and contacts in one tool. Outputs structured JSON for scripting. Includes a built-in MCP server so AI agents can use your email directly.
# Install
brew install nylas/nylas-cli/nylas
# Guided account, application, API key, and mailbox setup
nylas init
# Or, if you already have a Nylas API key
nylas auth config --api-key nyl_abc123
# Connect a mailbox grant when needed
nylas auth login
# Send an email
nylas email send --to alice@example.com --subject "Hello" --body "From the CLI"
# List recent emails as JSON
nylas email list --json --limit 10mailx (BSD Mail / Heirloom mailx)
The classic Unix mail command, first included in Unix System V in 1983 and later standardized as part of POSIX.2 (IEEE Std 1003.2). Available on virtually every POSIX system. Reads from the local mailbox or sends via sendmail/SMTP. Simple but limited: no OAuth, no JSON output, minimal attachment support. Best for sending quick notifications from cron jobs on systems where a local MTA is already configured.
# Send a simple email via local MTA
echo "Build failed" | mailx -s "CI Alert" dev@example.com
# Send via SMTP relay
echo "Report attached" | mailx -S smtp=smtp://relay.example.com \
-s "Daily Report" team@example.commutt / NeoMutt
A powerful terminal mail client first released in 1995, currently maintained at version 2.2.x. mutt provides a full TUI (text user interface) with support for IMAP, POP3, SMTP, GPG, and extensive customization via .muttrc. Excellent for power users who want to read and manage mail interactively in the terminal. Less suited for scripting because output is designed for humans.
# Open your IMAP inbox interactively
mutt -f imaps://user@imap.gmail.com
# Send a file as attachment from a script
mutt -s "Report" -a report.pdf -- team@example.com < body.txtmsmtp
A lightweight SMTP client first released in 2003 that acts as a sendmail replacement. msmtp excels at one thing: relaying messages to an SMTP server. Supports TLS and multiple accounts. No reading, no IMAP, no search. Ideal as a relay backend for other tools.
# Configure in ~/.msmtprc
# account default
# host smtp.gmail.com
# port 587
# auth on
# tls on
# user you@gmail.com
# password your-app-password
# Send via configured account
echo -e "Subject: Test\n\nHello" | msmtp recipient@example.comswaks (Swiss Army Knife for SMTP)
A purpose-built SMTP testing tool first released in 2003. swaks lets you craft raw SMTP sessions with full control over every protocol step. Perfect for testing mail server configurations, debugging delivery issues, and verifying SPF/DKIM setups. Not designed for day-to-day email use.
# Test SMTP connectivity
swaks --to test@example.com --server smtp.example.com --tls
# Test with authentication
swaks --to test@example.com --server smtp.gmail.com:587 \
--auth LOGIN --auth-user you@gmail.com --tls-on-connectHimalaya
A modern CLI email client written in Rust, first released in 2020 and actively maintained by the Pimalaya project. Himalaya supports IMAP, SMTP, Notmuch, and JMAP backends. It outputs JSON natively with --output json, making it more script-friendly than mutt or aerc. No built-in OAuth — Gmail and Outlook require external token helpers or app-specific passwords. Install takes under 30 seconds via Homebrew.
# Install
brew install himalaya
# List recent emails
himalaya envelope list
# List as JSON (useful for scripting)
himalaya envelope list --output json
# Read a specific message
himalaya message read 1
# Send an email
himalaya message write --to alice@example.comaerc
A terminal email client written in Go, first released in 2019 by Drew DeVault (aerc-mail.org). aerc features a tabbed TUI, built-in Git email patch workflow, and JMAP support. Popular with kernel developers and open-source contributors who send patches by email. Supports IMAP and SMTP. No built-in OAuth, no JSON output, and no non-interactive mode — aerc is TUI-only. Setup takes about 5 minutes.
# Install
brew install aerc
# Launch the TUI (interactive only)
aerc
# aerc is TUI-only — no non-interactive send command
# Use it for interactive email management, Git patch review,
# and tabbed multi-account workflowsFeature comparison
| Feature | Nylas CLI | Himalaya | aerc | NeoMutt | msmtp | mailx | swaks |
|---|---|---|---|---|---|---|---|
| Send email | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Read/search email | Yes | Yes (IMAP) | Yes (IMAP) | Yes (IMAP) | No | Local only | No |
| Calendar access | Yes | No | No | No | No | No | No |
| Contacts access | Yes | No | No | Address book | No | No | No |
| OAuth support | Built-in (6 providers) | No (external helpers) | No | Manual helper scripts | No (app passwords) | No | No |
| JSON output | Yes (--json) | Yes (--output json) | No | No | No | No | No |
| AI agent integration | MCP server built-in | No | No | No | No | No | No |
| JMAP support | No | Yes | Yes | No | No | No | No |
| GPG sign/encrypt | Yes | Yes | Yes | Yes | No | No | No |
| Attachments | Yes | Yes | Yes | Yes | Via stdin | Limited | Yes |
| Non-interactive mode | Yes (--yes) | Yes | No (TUI only) | Partial | Yes | Yes | Yes |
| Send without SMTP/Postfix | Yes (API-based) | No (needs SMTP) | No (needs SMTP) | No (needs SMTP) | No (is SMTP) | No (needs MTA) | No (is SMTP) |
| Multi-provider | Gmail, Outlook, Exchange, Yahoo, iCloud, IMAP | IMAP/SMTP/JMAP | IMAP/SMTP/JMAP | IMAP/POP3/SMTP | SMTP only | Local MTA / SMTP | SMTP only |
| Scheduling (send later) | Yes | No | No | No | No | No | No |
| Language | Go | Rust | Go | C | C | C | Perl |
| License | MIT | MIT | MIT | GPL | GPL | BSD/CDDL | GPL |
Among the seven tools compared, only Nylas CLI sends email without SMTP or Postfix configuration, provides OAuth2 for 6 providers, and includes a built-in MCP server for AI agents. Himalaya is the only other tool with native JSON output. aerc and NeoMutt are the strongest choices for interactive terminal mail, while msmtp and swaks remain the standard for SMTP relay and protocol testing.
Which CLI email client supports Gmail, Outlook, and IMAP?
The biggest practical difference between these tools is how they authenticate with modern email providers. Gmail and Outlook are phasing out app passwords in favor of OAuth 2.0. According to Google's September 2023 announcement, less secure app access has been removed for Workspace accounts. Microsoft followed a similar path, deprecating Basic Authentication for Exchange Online in October 2022. This matters for any tool that connects directly to SMTP or IMAP.
- Nylas CLI handles OAuth natively — no SMTP or Postfix needed. Run
nylas initafter installation for guided setup. If you already have an API key, runnylas auth config --api-key nyl_abc123, then usenylas auth loginto connect a mailbox. Tokens refresh automatically. Works with Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP. - NeoMutt can use OAuth with Gmail and Outlook, but you need to configure external helper scripts (like
oauth2.py) to fetch and refresh tokens. It works but requires manual setup. - Himalaya supports IMAP, SMTP, and JMAP but has no built-in OAuth. Gmail requires an app-specific password or an external token helper. JMAP support means it works natively with Fastmail.
- aerc supports IMAP, SMTP, and JMAP. Like Himalaya, no built-in OAuth — configure app passwords or external helpers for Gmail and Outlook.
- mailx, msmtp, swaks rely on app passwords or plain SMTP credentials. As providers tighten security, this approach becomes harder to maintain.
Use --provider when the default Gmail flow is not the mailbox you want. Google, Microsoft, and EWS open a browser OAuth flow. iCloud, Yahoo, and generic IMAP prompt for credentials or app-specific passwords.
# Nylas CLI: guided setup after installation
nylas init
# Existing API key path
nylas auth config --api-key nyl_abc123
# Google/Gmail is the default browser OAuth flow
nylas auth login
# Other browser OAuth providers
nylas auth login --provider microsoft
nylas auth login --provider ews
# Credential providers prompt for app-specific or IMAP credentials
nylas auth login --provider icloud
nylas auth login --provider yahoo
nylas auth login --provider imap
# mutt: requires manual OAuth helper script configuration
# ~/.muttrc
# set imap_authenticators="oauthbearer:xoauth2"
# set imap_oauth_refresh_command="python3 oauth2.py ..."
# msmtp: requires app-specific password
# ~/.msmtprc
# password your-app-specific-passwordHow does each tool handle scripting and automation?
CI/CD pipelines, cron jobs, and automation scripts need email tools that run non-interactively and produce parseable output. Of the seven tools compared here, only Nylas CLI and Himalaya output structured JSON natively — via --json and --output json respectively. The other five produce human-readable text that requires brittle regex parsing. aerc has no non-interactive mode at all since it is TUI-only.
Nylas CLI supports three scripting patterns: JSON output piped to jq, non-interactive send with --yes, and stdin piping for dynamic message bodies. Each pattern works without manual confirmation prompts.
# Nylas CLI: structured JSON output, perfect for jq
nylas email list --json --limit 5 | jq '.[].subject'
# Nylas CLI: non-interactive send (no confirmation prompt)
nylas email send --to ci@example.com --subject "Build passed" \
--body "All tests green" --yes
# Nylas CLI: pipe body from stdin
echo "Deployment complete at $(date)" | nylas email send \
--to ops@example.com --subject "Deploy notification" --yes
# mailx: works but output is human-readable only
echo "Alert" | mailx -s "Disk full" ops@example.comThe --json flag is a game changer for scripting. Instead of parsing human-readable output with fragile regex, you get structured data that tools like jq can process reliably. Here is what the difference looks like in practice:
Output comparison: NeoMutt vs Nylas CLI
The output format difference between NeoMutt and Nylas CLI illustrates why structured data matters for automation. A fragile regex that parses NeoMutt's columnar output breaks whenever a subject contains special characters or the column widths shift between versions — a problem that affects roughly 40% of mail-parsing scripts, according to the NeoMutt issue tracker. NeoMutt outputs human-readable text designed for terminal display:
1 N Mar 25 Sarah Chen (4.2K) Re: Project Atlas — Q2 launch timeline
2 Mar 24 DevOps Bot (1.8K) [Alert] CPU usage above 90%
3 Mar 24 Jamie Park (2.1K) Calendar invite: API Design ReviewNylas CLI outputs structured JSON that machines can parse directly:
[
{
"id": "a1b2c3d4e5f6g7h8",
"subject": "Re: Project Atlas — Q2 launch timeline",
"from": [{"name": "Sarah Chen", "email": "sarah@example.com"}],
"date": "2026-03-25T14:22:18-04:00",
"unread": true,
"folders": ["INBOX"]
}
]NeoMutt's output requires parsing with grep or awk — and the format varies across versions. Nylas CLI's JSON pipes directly into jq, Python, or an LLM agent's tool handler without any text munging. Himalaya's --output json produces similar structured output, making it the closest alternative for scripting.
Which tools work with AI agents?
None of the 6 traditional tools (mailx, NeoMutt, Himalaya, aerc, msmtp, swaks) were designed for AI agents. Himalaya's JSON output makes it usable as a subprocess tool, but it has no agent-specific features. Nylas CLI was built for this use case from the start:
- MCP server:
nylas mcp serveexposes 16 tools (email, calendar, contacts) via the Model Context Protocol. Claude Desktop, Cursor, VS Code, and Claude Code connect natively. - Subprocess pattern: AI agents can call
nylas email list --jsonas a subprocess and parse the structured output directly. - Non-interactive mode:
--yesskips confirmation prompts so agents can send without human intervention.
# Install MCP for Claude Code -- one command
nylas mcp install --assistant claude-code
# Now Claude Code can read, send, and schedule email
# without any custom tool definitions
# Or use as subprocess tool in your own agent
nylas email list --json --limit 5 --from boss@company.comWhen to use each tool
Each email CLI targets a different workflow. Picking the wrong one means fighting the tool instead of using it. The split comes down to three categories: API clients that bypass SMTP entirely, TUI clients for interactive inbox management, and relay/testing tools for raw SMTP operations.
- Nylas CLI — You need multi-provider access, JSON output, calendar/contacts, send without SMTP or Postfix, or AI agent integration. Best for: automation, CI/CD, AI agents, developer workflows across 6 providers.
- Himalaya — You want a modern, composable CLI email client with JSON output and JMAP support. Best for: Rust enthusiasts, Fastmail users, scripting with structured output.
- aerc — You want a modern tabbed TUI with built-in Git patch support. Best for: kernel developers, open-source contributors who review patches by email.
- NeoMutt — You want maximum customization and a decades-deep ecosystem. Best for: power users who live in the terminal, GPG workflows, complex filtering.
- msmtp — You need a lightweight sendmail replacement. Best for: systems where other tools (git, cron) need to relay mail through SMTP.
- mailx — You need to send simple notifications from a server with a configured local MTA. Best for: cron job alerts, minimal dependencies.
- swaks — You need to test SMTP server configurations or debug delivery. Best for: mail server administrators, deliverability engineers.
How fast is each tool to set up?
Setup time varies from 30 seconds to 30 minutes depending on the tool and whether you need OAuth. Nylas CLI requires approximately 2 minutes for Homebrew install plus guided setup with nylas init — no SMTP or Postfix needed. Himalaya takes about 5 minutes (install + configure ~/.config/himalaya/config.toml with IMAP/SMTP credentials). aerc is similar at 5 minutes. NeoMutt needs around 15 minutes for initial .muttrc configuration. msmtp takes roughly 10 minutes for ~/.msmtprc SMTP setup. swaks is faster at about 5 minutes if you already know your SMTP server details.
# Nylas CLI: ~2 minutes (install + guided setup)
brew install nylas/nylas-cli/nylas
nylas init
# Or, if you already have a Nylas API key
nylas auth config --api-key nyl_abc123
# Connect a mailbox grant when needed
nylas auth login
nylas email send --to test@example.com --subject "Hello" --body "It works"
# Himalaya: ~5 minutes (install + configure IMAP/SMTP in config.toml)
brew install himalaya
# Edit ~/.config/himalaya/config.toml with IMAP/SMTP credentials...
himalaya envelope list
# aerc: ~5 minutes (install + configure accounts.conf)
brew install aerc
# Edit ~/.config/aerc/accounts.conf with IMAP/SMTP settings...
aerc
# NeoMutt: ~15 minutes (install + configure .muttrc + OAuth or app password)
brew install neomutt
# Edit ~/.muttrc with IMAP/SMTP settings...
# msmtp: ~10 minutes (install + configure ~/.msmtprc + app password)
brew install msmtp
# Edit ~/.msmtprc with SMTP settings...
# mailx: ~1 minute if local MTA exists, 30+ minutes if not (needs Postfix)
echo "Hello" | mailx -s "Test" test@example.com
# swaks: ~5 minutes (install + know your SMTP server)
brew install swaks
swaks --to test@example.com --server smtp.example.comFrequently asked questions
Can I use Nylas CLI as a sendmail replacement like msmtp?
Nylas CLI does not implement the sendmail interface, so you cannot drop it in as a system MTA. However, for scripting purposes, piping to nylas email send --yes is equivalent. For system-level mail delivery (cron notifications, log alerts), msmtp is a better fit.
Is Nylas CLI free?
Yes. Nylas CLI is free, open-source, and MIT licensed. Install it with brew install nylas/nylas-cli/nylas. There are no usage limits on the CLI itself.
Can mutt connect to Gmail without app passwords?
Yes, mutt supports OAuth2 for Gmail, but it requires configuring an external token refresh helper script. Google's oauth2.py script or similar tools handle the token exchange. It works but is significantly more setup than Nylas CLI's one-command OAuth flow.
Which tool is best for email testing in CI/CD?
For testing email delivery (SMTP configuration, SPF/DKIM), use swaks. For testing application email flows (send a real email and verify it arrives), use Nylas CLI with --json output in your test scripts. See the E2E email testing with Playwright guide.
Do any of these tools support Exchange on-premises?
Nylas CLI supports Exchange Online and on-premises Exchange via EWS (Exchange Web Services). mutt can connect to Exchange via IMAP if it is enabled. The other tools only support SMTP, which may or may not be available on your Exchange server.
Next steps
- Send email from the terminal -- detailed guide for Nylas CLI email workflows
- Gmail CLI: Send Gmail from Command Line -- Gmail-specific send workflow without SMTP or Gmail API setup
- Gmail CLI -- list, search, and read Gmail from the terminal
- Outlook CLI -- list, search, and read Microsoft 365 mail without Graph setup
- Google Calendar CLI -- list events, create meetings, and check availability
- AI agent CLI for email and calendar -- wrap CLI commands as LLM tools
- Give AI agents email access via MCP -- set up the MCP server for Claude, Cursor, or VS Code
- GPG encrypted email from the CLI -- sign and encrypt email with Nylas CLI
- Nylas CLI vs Recall.ai -- email/calendar vs meeting recordings for AI agents
- Search email from the terminal -- compare Gmail, Graph, and IMAP search syntax
- Best CLI calendar tools compared -- gcalcli, khal, calcurse, remind, and Nylas CLI
- Full command reference -- every flag, subcommand, and example