WordPress
Send wp_mail() — and every plugin that uses it — to a sandbox instead of the site's host.
Prerequisites
- The WP Mail SMTP plugin (or any SMTP plugin)
1Configure the plugin
Either fill in the plugin's settings screen, or put the values in wp-config.php where they survive a database export:
// wp-config.php — above "That's all, stop editing!" define( 'WPMS_ON', true ); define( 'WPMS_MAILER', 'smtp' ); define( 'WPMS_SMTP_HOST', 'smtp.mailclutch.com' ); define( 'WPMS_SMTP_PORT', 587 ); define( 'WPMS_SSL', 'tls' ); define( 'WPMS_SMTP_AUTH', true ); define( 'WPMS_SMTP_USER', 'mc_0000000000000000' ); define( 'WPMS_SMTP_PASS', 'pw_0000000000000000' );
2Send a test message
WP Mail SMTP has an Email Test tab under its settings. Or from WP-CLI:
wp eval "wp_mail( 'anyone@example.com', 'Sandbox check', 'Hello from WordPress.' );"Watch it land
Open the sandbox and the message is there — rendered HTML, plain text, raw source, attachments, and the SPF, DKIM and DMARC verdicts. It updates live, so you can leave it open next to your terminal.
Nothing is ever delivered onward, whatever address you send to; claim the sandbox with an account and it stays.
Awaiting your email
Send from any address; it stops here rather than going onward. The sandbox keeps what it catches for 24 hours.
Go further
Staging clones
Point the clone here and account emails, WooCommerce receipts and form notifications stay inside the sandbox instead of reaching real customers.
From address
The sandbox accepts any From address, so a test here cannot tell you whether yours is valid. Keep it on a domain you control, as it will have to be in production.
Other stacks
The same four values in another dialect. Every guide below is filled in with the sandbox pair at the top of this page.
Frameworks and languages
- LaravelFive .env variables, no package
- SymfonyOne MAILER_DSN
- DjangoFive settings, nothing installed
- RailsAction Mailer smtp_settings
- Node.jsA Nodemailer transport
- Next.jsRoute Handler or Server Action
- Gonet/smtp, standard library
- SpringFive Spring Boot properties
- JavaJakarta Mail, no framework
- .NETMailKit: connect, auth, send
- PHPPHPMailer, no framework
- Pythonsmtplib, standard library
- Rustlettre over a STARTTLS relay