Frameworks

WordPress

Use the official Lettermint WordPress plugin to route wp_mail() through Lettermint. This guide uses WP-CLI to configure, test, monitor, and deploy the plugin across one or more sites. See Integrations for other packages.

Requirements

The plugin needs WordPress 6.4 or higher and PHP 7.4 or higher, plus a Project API token from your project settings.

Install from the command line

Install and activate the plugin with a single WP-CLI command:

TerminalCode
wp plugin install lettermint --activate

Once the API token is set, every WordPress email routes through Lettermint automatically. There are no theme or plugin code changes to make.

Configure with constants instead of the database

The settings screen writes configuration to the database, which is fine for one site. For version-controlled or scripted setups, define the same values as constants in wp-config.php. This keeps your token out of the database and makes configuration portable across staging and production:

PHPCode
define( 'LETTERMINT_API_TOKEN', 'lm_...' ); define( 'LETTERMINT_FROM_EMAIL', 'hello@example.com' ); define( 'LETTERMINT_FROM_NAME', 'Example Store' );

Or set them directly with WP-CLI, which is handy in deploy scripts:

TerminalCode
wp config set LETTERMINT_API_TOKEN lm_...

Constants take precedence over anything saved in the settings screen. Run wp lettermint info to confirm which value is active and where it comes from. The full set of constants:

ConstantPurpose
LETTERMINT_API_TOKENProject API token (required)
LETTERMINT_FROM_EMAILDefault sender address
LETTERMINT_FROM_NAMEDefault sender name (falls back to the site name)
LETTERMINT_FORCE_EMAILOverride sender addresses set by other plugins
LETTERMINT_FORCE_FROM_NAMEOverride sender names set by other plugins
LETTERMINT_FORCE_HTMLSend all mail as HTML
LETTERMINT_ROUTE_SLUGSend through a specific route
LETTERMINT_TAGApply a tag to every email
LETTERMINT_LOG_LEVELLogging level
LETTERMINT_LOG_RETENTION_DAYSDays to keep logs

WP-CLI command reference

The plugin registers a wp lettermint command for managing and debugging the integration from the terminal.

CommandWhat it does
wp lettermint statusCheck that your API token is valid
wp lettermint test <email>Send a test email through Lettermint
wp lettermint infoShow the resolved configuration and where each value comes from
wp lettermint logsList recent log entries (--type, --search, --number, --format)
wp lettermint statsShow a summary of the log
wp lettermint prune --days=30Delete log entries older than N days

Verify the connection

TerminalCode
wp lettermint status

Send a live test email

TerminalCode
wp lettermint test you@example.com

Inspect the resolved configuration

info reports every setting and its source (constant, environment variable, or settings screen), which is the fastest way to see why a value is what it is:

TerminalCode
wp lettermint info

Query the logs

logs accepts --type, --search, --number, and --format so you can filter and pipe the output:

TerminalCode
# Most recent entries wp lettermint logs # The last 50 failed emails as JSON wp lettermint logs --type=error --number=50 --format=json # Find entries by recipient or subject wp lettermint logs --search="invoice"

Review statistics and prune

TerminalCode
wp lettermint stats wp lettermint prune --days=30

Roll out across many WordPress sites

The plugin resolves each setting from a PHP constant, then an environment variable, and then the database. Set the LETTERMINT_* variables on each WordPress container to use the same deployment configuration without writing values to the settings screen, wp-config.php, or the database.

Keep the token in a .env file that Docker Compose reads automatically, and pass the variables to your WordPress service:

Code
LETTERMINT_API_TOKEN=lm_...
YAMLCode
services: wordpress: image: wordpress:php8.3-apache environment: LETTERMINT_API_TOKEN: ${LETTERMINT_API_TOKEN} LETTERMINT_FROM_EMAIL: hello@example.com LETTERMINT_TAG: client-one volumes: - wp:/var/www/html # plus your database service and the usual WORDPRESS_DB_* settings # WP-CLI helper for install, activation, and the lettermint commands wpcli: image: wordpress:cli environment: LETTERMINT_API_TOKEN: ${LETTERMINT_API_TOKEN} volumes: - wp:/var/www/html volumes: wp:

Install and activate the plugin once, then verify the container from the WP-CLI helper:

TerminalCode
docker compose run --rm wpcli wp plugin install lettermint --activate docker compose run --rm wpcli wp lettermint status docker compose run --rm wpcli wp lettermint test ops@example.com

Running many sites is then one service per site, all on the same official WordPress image. Give each its own LETTERMINT_TAG or LETTERMINT_ROUTE_SLUG while they share a single token, so you can filter each site's mail in your dashboard. Install the plugin per site with the same wpcli helper shown above, or mount it into each container:

YAMLCode
services: client-one: image: wordpress:php8.3-apache environment: LETTERMINT_API_TOKEN: ${LETTERMINT_API_TOKEN} LETTERMINT_TAG: client-one client-two: image: wordpress:php8.3-apache environment: LETTERMINT_API_TOKEN: ${LETTERMINT_API_TOKEN} LETTERMINT_ROUTE_SLUG: client-two-route

Keep deliverability high

Routing through Lettermint handles delivery, but inbox placement still depends on your DNS. Verify each sending domain and publish the records Lettermint gives you:

Logging and privacy

The plugin keeps a local log you can read with wp lettermint logs or under Settings → Lettermint. Pick the level that matches your privacy needs. Metadata-only mode is a good default when you want an audit trail without storing message content:

LevelWhat is recorded
DisabledNothing
Errors onlyOnly failed sends
Metadata onlyRecipient, subject, sender, and headers, without the message body
FullEverything, including the email content

Set Log Retention to prune old entries automatically after a number of days, or to 0 to keep logs indefinitely. You can also prune on demand with wp lettermint prune.

Troubleshooting

If email is not arriving:

  1. Run wp lettermint status to confirm the token is valid
  2. Send wp lettermint test you@example.com to trigger a live send
  3. Check wp lettermint logs --type=error for recent failures
  4. Run wp lettermint info to confirm the from address and route resolve as expected

The plugin also detects other mail or SMTP plugins that also hook into wp_mail() and warns you in the admin. Only one mailer should handle wp_mail() at a time, so deactivate the others.

FAQ

Does Lettermint keep WordPress email data in the EU?

Yes. Lettermint runs exclusively on European infrastructure and processes email in line with GDPR, so transactional mail from your WordPress site is handled inside the EU.

Can I set up the plugin without the WordPress admin UI?

Yes. Define the LETTERMINT_* constants in wp-config.php or set them with wp config set, then verify with wp lettermint status. Nothing needs to be entered in the settings screen.

How do I configure Lettermint on many WordPress sites at once?

Store the API token in your environment and script the rollout with WP-CLI. The provisioning loop above installs, activates, configures, and tests every site without touching the admin for any of them.

How do I confirm WordPress email works from the command line?

Run wp lettermint status to validate the token and wp lettermint test you@example.com to send a live test. Use wp lettermint logs --type=error to see any failures.

Does the plugin use SMTP?

No. The plugin intercepts wp_mail() through WordPress's pre_wp_mail filter and sends via the Lettermint API, so it leaves your PHPMailer and SMTP settings untouched. If you specifically need SMTP relay, follow the SMTP guide instead. Both deliver through the same EU infrastructure.

Next steps

Tags

Organize and filter emails with tags.

Tracking

Track opens, clicks, and deliverability.

Webhooks

Receive delivery events through webhooks.

SMTP Alternative

Send via SMTP instead of the plugin.

WordPress Plugin Directory

View the plugin listing, changelog, and reviews on WordPress.org.