Introducing the SendLayer CLI: Send email from your terminal

Editorial Note: We may earn a commission when you visit links on our website.
SendLayer CLI featured image

Ever needed to send one email from a script?

A deploy alert, a nightly report, a quick test. Until now, each one meant writing API request code or wiring up SMTP first.

We’ve just released the SendLayer CLI, a free command-line tool for sending email, checking delivery, and testing webhooks!

It sends from your terminal, your scripts, your CI pipelines, and your AI coding agents. It’s open source and works with any SendLayer account.

  • 200 Free Emails
  • Easy Setup
  • 5 Star Support

Send an email with one command

Need an email sent? Now it’s one line in your terminal.

Run sendlayer emails send with a sender, a recipient, a subject, and your message. SendLayer confirms it right away with the message ID.

Sending a test email from the terminal with the SendLayer CLI

It handles more than plain text, too. Send HTML straight from a file, attach a PDF, add CC and BCC, and tag the email for your reports.

If you’ve ever written a whole script just to send one test email, this is the command you’ll reach for instead.

See what happened to every email

Sending an email is half the job. Knowing it arrived is the other half.

Run sendlayer events list with a message ID, and you’ll see each step that email went through, from accepted to delivered. You can also filter by event, like every email that failed today.

SendLayer CLI events list showing accepted and delivered events

When someone says an email never came, you can check in seconds without leaving your terminal.

Pro Tip: Not sure what each status means? Our guide to email delivery status explains them.

Test webhooks without deploying anything

Webhooks are hard to test. SendLayer needs a public address to send events to, and your laptop doesn’t have one.

The new sendlayer webhooks listen command fixes that. Pair it with a tunnel like ngrok, and real SendLayer events show up in your terminal while you build.

sendlayer webhooks listen receiving a webhook event

It creates the webhooks it needs and can pass each event on to your local app. When you press Ctrl+C, it deletes every webhook it made, so nothing is left behind in your account.

You can also list, create, and delete your permanent webhooks with the CLI.

Built for scripts, CI pipelines, and AI agents

The SendLayer CLI knows where it’s running.

In your terminal, you get easy-to-read output. In a script, a CI job, or an AI coding agent, it switches to JSON automatically. Each kind of failure also returns its own exit code, so your pipeline knows exactly what went wrong.

SendLayer CLI running in a terminal, a CI pipeline, and an AI coding agent

That makes it easy to email your team from a GitHub Actions workflow when a release goes out. Just store your API key as a secret.

AI coding agents like Claude Code, Cursor, and Codex can run the same commands. They get JSON back and can tell whether each one worked.

Already using the SendLayer MCP Server? It’s still the best fit for chat apps like Claude Desktop. The CLI covers everything that runs in a shell.

One CLI for every SendLayer account

Look after more than one account? Save each API key under its own profile, like staging, production, or a client’s name.

Then add --profile to any command to choose which account it uses. Run sendlayer whoami to check which one is active. It always hides most of your key.

sendlayer whoami output with a masked API key

If you manage email for clients, this is how you switch between them without mixing up keys.

  • 200 Free Emails
  • Easy Setup
  • 5 Star Support

What we’re building next

We built the SendLayer CLI for the moments when you just want to send from your terminal. This is its first release, version 0.1.0.

The CLI is free. Your emails count toward your SendLayer plan, and the free trial includes 200 emails.

Install it today with npm install -g sendlayer-cli, or download a standalone build for Linux, macOS, or Windows from the GitHub release page. Then run sendlayer login and send your first email! The CLI documentation covers every command.

Found a bug or have an idea? Tell us in the SendLayer CLI GitHub repository.

Until the next update, happy sending!

author avatar
Gregor Capuder
Gregor is the Product Manager of several WordPress plugins and services, including WP Mail SMTP, Easy WP SMTP, SendLayer, and Sugar Calendar.