---
title: "WP-CLI now available in our WordPress plugin"
description: "Our WordPress plugin now supports WP-CLI. Set up Lettermint and manage emails from the command line, useful when you maintain many WordPress websites."
url: "https://lettermint.co/changelog/wordpress-plugin-wp-cli-support"
published: "2026-06-29"
last_updated: "2026-06-29"
---

# WP-CLI now available in our WordPress plugin

> Our WordPress plugin now supports WP-CLI. Set up Lettermint and manage emails from the command line, useful when you maintain many WordPress websites.

Manage a lot of WordPress websites, for example as an
[agency](https://lettermint.co/for/agencies), and
you don't want to set up email on every site separately. That's
why our WordPress plugin now works with WP-CLI. You set up
Lettermint from the command line and put those steps in your own
scripts or deploys.

This update brings more than WP-CLI alone. You can now also set
up the plugin through wp-config or environment variables, so your
API token stays out of the database. And you now decide how long
sending data stays in your logs.

## WP-CLI

[WP-CLI](https://wp-cli.org) is the official command line tool
for WordPress. It lets you manage a site from the terminal
instead of the wp-admin area, for things like installing plugins,
running updates or changing settings. Especially handy when you
do that across many sites at once.

The plugin adds a `wp lettermint` command. With it you check your
settings and send a test email without logging in to the site.

- `wp lettermint status` checks your API token
- `wp lettermint test you@example.com` sends a test email
- `wp lettermint info` shows the active configuration
- `wp lettermint logs` shows recent log entries with filters
- `wp lettermint stats` shows your sent emails
- `wp lettermint prune --days=30` removes old log entries

WP-CLI becomes really powerful in combination with the rest of
the tool. You set up a new client site in one go from the command
line, without a single step in the dashboard.

```bashsimple
wp plugin install lettermint --activate
wp config set LETTERMINT_API_TOKEN lm_project_token --type=constant
wp config set LETTERMINT_FROM_EMAIL hello@example.com --type=constant
wp config set LETTERMINT_FORCE_EMAIL 1 --type=constant
```

After that you check that everything works.

```bashsimple
wp lettermint status
wp lettermint test you@example.com
```

You put these steps in a provisioning script, deploy pipeline or
site template, so every client site gets the same email settings.

Combine this with our
[Team API](https://lettermint.co/changelog/team-api-now-in-preview-manage-your-account-via-api),
and you automate the setup from start to finish. Create an API
token per client or add a new domain to send from, and pass that
token straight to WP-CLI.

![Lettermint WP-CLI](https://lettermint.co/content/changelog/lettermint-wp-cli.webp)

## Set up via wp-config

As you saw in the WP-CLI example above, we used `wp config set`
to write your API token. That works now because you can set every
option as a *PHP constant* or *environment variable* instead of
through the dashboard. Good for staging and production, and for
*config-as-code* where you manage settings in your repository
instead of per site.

```phpsimple
define( 'LETTERMINT_API_TOKEN', 'lm_project_token' );
define( 'LETTERMINT_FROM_EMAIL', 'hello@example.com' );
```

Every setting has its own *constant*, from your API token to the
log level. Your token stays out of the database, even when you
share your code or put it in version control.

> **Note:** Settings from wp-config or an *environment variable* take
> precedence over what you enter in WordPress. That's why they
> show up there as *read-only*.

## Log levels and retention

You now decide yourself whether and how you store email data.
Logging used to be only on or off. Now you choose from four
levels:

- Store nothing
- Errors only
- Metadata, without the email content
- The full email

That way you keep no more than you need.

On top of that you set a retention period. Log entries older than
your period are removed. If you'd rather not keep data longer than
necessary, you set a short period.

## Now available

Update the Lettermint plugin to the latest version from your
WordPress admin area or the
[WordPress Plugin Directory](https://wordpress.org/plugins/lettermint/).
