How to choose an email CLI: inbox access, delivery, or SMTP testing

How to choose an email CLI: inbox access, delivery, or SMTP testing

• 5 min read

Disclosure: Nylas publishes this post and builds the Nylas CLI. We cover where it fits and where a different kind of tool is the better choice.

Most “best command line email client” lists compare tools that do different jobs. A terminal mail reader and an SMTP relay solve different problems, so ranking them on one scale produces a confusing answer. Split the category first.

What are the three jobs an email CLI does?

An email CLI is a command-line tool for sending, reading, or managing email from a terminal. Each tool tends to fit one of these jobs.

JobWhat you needTool type
Read and manage a mailboxIMAP/SMTP access, search, foldersMail user agent (MUA) in a terminal UI, or a scriptable CLI
Deliver a message from a scriptA relay or an API callSMTP relay client (MTA-style), or an API client
Debug mail serversRaw control over each SMTP stepSMTP testing tool

Nylas CLI is an API client. It talks to six providers (Gmail, Outlook, Exchange, Yahoo, iCloud, and any IMAP server) through the Nylas platform, so you do not configure SMTP, IMAP, or OAuth by hand.

Where do the other tools fit?

  • mailx is the classic Unix mail command, specified in POSIX. It suits quick cron notifications on systems where a local MTA already exists.
  • NeoMutt is a project that gathered Mutt’s patches into one codebase, according to its README. It is a terminal mail client.
  • aerc describes itself as an email client that runs in your terminal.
  • msmtp, by default, reads a mail from standard input and sends it to an SMTP server, according to its man page.
  • swaks is a scriptable, transaction-oriented SMTP test tool, according to its README.
  • Himalaya describes itself as a CLI to manage emails. Its README lists IMAP, SMTP, JMAP, Gmail REST API, and Microsoft Graph support, plus xoauth2 authentication. It is a scriptable CLI that can reach Gmail and Outlook, not only a terminal client.

For a command line SMTP client, msmtp and swaks are the right comparison set. Choose them when the task is relay or protocol testing and you already have credentials that work.

Where does an API-based CLI fit?

Use an API client when the work involves several providers, OAuth, or structured output for scripts. With the Nylas CLI:

# 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 10

The CLI covers email, calendar, and contacts in one tool, outputs JSON for scripting, and includes an MCP server so an AI agent can use the mailbox. It is open source under the MIT license.

How do I pick one? A quick decision guide

  1. You need to send a notification from a server that already has a mail relay: use a relay client.
  2. You need to read mail interactively on one account: use a terminal mail client.
  3. You need to test why a message is rejected: use an SMTP testing tool.
  4. You need one scriptable CLI across Gmail, Outlook, or other providers, or you are connecting an AI assistant: use a multi-provider CLI. Himalaya and the Nylas CLI both fit. Nylas also covers calendar and contacts and includes an MCP server.

Many teams use two of these together, for example a multi-provider CLI for automation and swaks for diagnostics.

When does a script become a product?

A CLI covers your own mailboxes. If your application needs every customer’s inbox, the same unified model is available through the Nylas Email API, with webhooks for new messages and one integration across providers. The developer docs say the Email API works across Gmail, Microsoft 365, Exchange, Yahoo, iCloud, and IMAP providers. Read the full side-by-side in the original comparison guide, and install the CLI with brew install nylas/nylas-cli/nylas.

Frequently asked questions

What’s the best command-line email client for Gmail and Outlook?

It depends on the job, and no published benchmark ranks these tools. To read mail interactively on one account, use a terminal client such as aerc or NeoMutt. For one scriptable CLI across providers, Himalaya and the Nylas CLI both reach Gmail and Outlook.

What’s the best CLI tool for sending email from the terminal?

If the server already has a mail relay, a relay client such as msmtp fits. If you have no relay and want to send without SMTP settings, an API client works: with the Nylas CLI, nylas email send takes --to, --subject, and --body.

What’s a good alternative to mutt for reading email in the terminal?

NeoMutt and aerc are terminal mail clients. Himalaya is a CLI for managing email with IMAP, SMTP, JMAP, Gmail REST API, and Microsoft Graph support. The Nylas CLI is another option if you want one set of commands across Gmail, Outlook, and IMAP accounts.

What CLI tools let an AI agent read and send email?

The Nylas CLI includes an MCP server, so an AI assistant can use the mailbox through the same connection.

What are the three jobs an email CLI does?

Reading and managing a mailbox, delivering a message from a script, and debugging mail servers. Terminal mail clients fit the first, relay or API clients fit the second, and SMTP testing tools such as swaks fit the third. Pick the tool by the job.

Sources

Related resources

How to list IMAP emails from the terminal

Every IMAP server needs its own hostname, port, TLS mode, and authentication method, and getting…

Gmail SMTP Settings: Server, Ports, App Passwords, and OAuth

Gmail’s outgoing server is smtp.gmail.com. It accepts connections on port 587 with STARTTLS and port…

How to connect Claude to your email with MCP

Claude has built-in connectors for Gmail and Microsoft 365, but nothing for Yahoo, iCloud, Exchange,…