CLI app
Mailtrap CLI is a command-line tool for accessing Mailtrap features that allow you to send emails, inspect sandbox inboxes, monitor deliverability stats, and administer domains, templates, contacts, and more, all from your terminal.
Link to official GitHub documentation.
How it works
Installation
To install Mailtrap CLI app, choose one of the following installation methods:
Homebrew (macOS / Linux):
brew install mailtrap/cli/mailtrapDownload binary
Download the latest release from GitHub Releases and add it to your PATH.
Go install:
go install github.com/mailtrap/mailtrap-cli@latestAuthentication
To validate your token, detect your account ID, and save both to ~/.mailtrap.yaml run the following command:
mailtrap configure --api-token YOUR_TOKENOr, you can also use environment variables:
export MAILTRAP_API_TOKEN=your-tokenUsing the CLI
Then use any of the ~87 commands across 20 resource groups. A few examples:
Every command supports --output json for scripting and CI/CD integration. Shell completion is available for Bash, Zsh, Fish, and PowerShell.
Use case examples
Test before you send
Here's how you can verify your email renders correctly in sandbox before sending to real users.
Email marketing – build and send a campaign
You can also send an email marketing campaign from the Mailtrap CLI app, covering everything from managing contacts to creating email templates. Here's how:
Analytics – monitor email performance
Once you start sending emails, use the Mailtrap CLI app to track delivery, opens, clicks across categories and providers, and more.
Last updated
Was this helpful?

