Skip to content

WP-CLI

Stacko Mail registers the wp stacko-mail command with four subcommands.

Command What it does
wp stacko-mail status Shows connections, credential health and today’s numbers.
wp stacko-mail test Sends a test email through a connection.
wp stacko-mail logs Lists or purges the email log.
wp stacko-mail domain-check Checks SPF, DKIM, DMARC and MX. Exits non-zero on problems.
Terminal window
wp stacko-mail status [--format=<format>]
Option Description
--format table (default), json or yaml.

Outputs key / value rows:

Key Value
version Plugin version.
primary Label of the primary connection’s mailer, or none.
backup Label of the backup connection’s mailer, or none.
credentials ok, or UNREADABLE (re-enter in Connections) when a saved secret can’t be decrypted.
email_control off, pause or redirect.
sent_today Emails sent today.
failed_today Emails failed today.
Terminal window
wp stacko-mail status --format=json
Terminal window
wp stacko-mail test <to> [--connection=<slot>]
Argument / option Description
<to> Recipient email address.
--connection primary (default) or backup.

Sends a short test email through the chosen connection. On success it prints the mailer and time taken. On failure it prints the plain-language explanation and the steps to fix it, then exits with an error.

The test email is sent straight through the connection, so it goes out even while email control is pausing or redirecting emails. It’s logged with the source stacko-mail-test.

Terminal window
wp stacko-mail test me@example.com
wp stacko-mail test me@example.com --connection=backup
Terminal window
wp stacko-mail logs list [--status=<status>] [--search=<text>] [--limit=<n>] [--format=<format>]
wp stacko-mail logs purge [--older-than=<days>] [--yes]
Option Description
--status Only emails with this status: sent, failed, blocked, redirected or sending.
--search Recipient or subject contains this text.
--limit How many emails to list. Default 20, maximum 100.
--format table (default), json, csv, yaml or count.

Columns: id, time, status, to, subject, source, mailer, error (the error code).

Terminal window
wp stacko-mail logs list --status=failed
wp stacko-mail logs list --search=example.com --format=json
Option Description
--older-than Delete emails older than this many days. Without it, every email is deleted.
--yes Don’t ask for confirmation.
Terminal window
wp stacko-mail logs purge --older-than=90 --yes
Terminal window
wp stacko-mail domain-check [<domain>] [--selector=<selector>] [--format=<format>]
Argument / option Description
<domain> Domain to check. Default: the domain WordPress sends from.
--selector An extra DKIM selector to check, on top of the ones known for the connected mailer.
--format table (default) or json.

The table lists each check (SPF, DKIM, DMARC, MX) with its status (pass, warn, fail or unknown), the result, and the DNS record to add when there is a fix. It ends with the Email Health Score. json prints the full result, including the score breakdown.

The command always runs a fresh check (no cache). It exits with status 1 if any check has the status fail, so you can use it in CI or monitoring.

It uses the server’s DNS, or Cloudflare DNS-over-HTTPS if that is turned on in Settings. If PHP DNS lookups are disabled on the server and DNS-over-HTTPS is off, the command stops with an error.

Terminal window
wp stacko-mail domain-check
wp stacko-mail domain-check example.com --selector=s1
wp stacko-mail domain-check --format=json