You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While having the wp mail send will be useful, I actually thing the other subcommands might have more value for many developers.
Proposed subcommands:
wp mail send <to> <subject> <body> [--format=<text|html>]: A clean wrapper for wp_mail() to easily dispatch messages from the CLI.
wp mail test <to>: Sends a standard test message but temporarily forces PHPMailer's $phpmailer->SMTPDebug to output verbose connection logs to the terminal. This would be invaluable for debugging SMTP plugin configurations or server-level mail blocks.
wp mail status or wp mail config: Outputs a table showing the current mail configuration (e.g., whether a plugin is hooking into phpmailer_init, the default From address, and content type).
Describe alternatives you've considered
The current alternative is using wp eval 'wp_mail(...);', which works for simple sending but is messy for HTML/attachments and provides zero debugging feedback if the mail fails to send due to a configuration or SMTP error.
Additional context
Having this natively in WP-CLI would save significant time for developers troubleshooting deliverability issues, especially on headless setups or when verifying automated server deployments.
@swissspidy I have done something similar in the past. This code was AI generated, and I tested this command on 2 of our sites, and they seem to work great. I didn't do as a PR because I thought it could use more eyes and probably discussion first.
Activity
swissspidy commentedon Feb 21, 2026
Previously:
Thanks for sharing some working code alongside your feature request!
For debugging or scripting purposes I agree some more verbose output like that could be useful.
Have you successfully used that command yourself on your sites?
bhubbard commentedon Feb 23, 2026
@swissspidy I have done something similar in the past. This code was AI generated, and I tested this command on 2 of our sites, and they seem to work great. I didn't do as a PR because I thought it could use more eyes and probably discussion first.