WordPress
The official Lettermint plugin hooks into WordPress's wp_mail() function and delivers every message your site sends through Lettermint's European infrastructure. Because Lettermint runs entirely inside the EU and processes mail in line with GDPR, your WordPress transactional email stays within Europe.
Most people install the plugin and configure it from Settings → Lettermint in the WordPress admin, and that is all a single site needs. This guide is for the next step: driving the plugin from WP-CLI so you can configure, test, and monitor Lettermint without opening the browser, and roll it out across many sites at once. That makes it a good fit for agencies and teams that manage a lot of WordPress installations.
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:
Code
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:
wp-config.php
Or set them directly with WP-CLI, which is handy in deploy scripts:
Code
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:
| Constant | Purpose |
|---|---|
LETTERMINT_API_TOKEN | Project API token (required) |
LETTERMINT_FROM_EMAIL | Default sender address |
LETTERMINT_FROM_NAME | Default sender name (falls back to the site name) |
LETTERMINT_FORCE_EMAIL | Override sender addresses set by other plugins |
LETTERMINT_FORCE_FROM_NAME | Override sender names set by other plugins |
LETTERMINT_FORCE_HTML | Send all mail as HTML |
LETTERMINT_ROUTE_SLUG | Send through a specific route |
LETTERMINT_TAG | Apply a tag to every email |
LETTERMINT_LOG_LEVEL | Logging level |
LETTERMINT_LOG_RETENTION_DAYS | Days to keep logs |
WP-CLI command reference
The plugin registers a wp lettermint command for managing and debugging the integration from the terminal.
| Command | What it does |
|---|---|
wp lettermint status | Check that your API token is valid |
wp lettermint test <email> | Send a test email through Lettermint |
wp lettermint info | Show the resolved configuration and where each value comes from |
wp lettermint logs | List recent log entries (--type, --search, --number, --format) |
wp lettermint stats | Show a summary of the log |
wp lettermint prune --days=30 | Delete log entries older than N days |
Verify the connection
Code
Send a live test email
Code
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:
Code
Query the logs
logs accepts --type, --search, --number, and --format so you can filter and pipe the output:
Code
Review statistics and prune
Code
Roll out across many WordPress sites
The plugin resolves each setting from a PHP constant first, then an environment variable, and only then the database. That order makes a containerised fleet effortless: set the LETTERMINT_* variables on a WordPress container and the site sends through Lettermint the moment it boots, with nothing written 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:
.env
docker-compose.yml
Install and activate the plugin once, then verify the container from the WP-CLI helper:
Code
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:
docker-compose.yml
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:
- Verify your sending domain with DKIM
- Configure SPF so receivers trust your mail
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:
| Level | What is recorded |
|---|---|
| Disabled | Nothing |
| Errors only | Only failed sends |
| Metadata only | Recipient, subject, sender, and headers, without the message body |
| Full | Everything, 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:
- Run
wp lettermint statusto confirm the token is valid - Send
wp lettermint test you@example.comto trigger a live send - Check
wp lettermint logs --type=errorfor recent failures - Run
wp lettermint infoto 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 real-time delivery notifications.
SMTP Alternative
Send via SMTP instead of the plugin.
WordPress Plugin Directory
View the plugin listing, changelog, and reviews on WordPress.org.