Symfony
One DSN in .env.local sends every Symfony Mailer message to a sandbox.
Prerequisites
- PHP 8.1 or later
- symfony/mailer
1Install the mailer
Skip this if the component is already there.
composer require symfony/mailer2Point the DSN at the sandbox
# .env.local MAILER_DSN=smtp://mc_0000000000000000:pw_0000000000000000@smtp.mailclutch.com:587
Keep it in .env.local rather than .env: the credentials are per environment, and that file is not committed.
3Send a test message
php bin/console mailer:test anyone@example.comOr from your own code:
use Symfony\Component\Mime\Email; $email = (new Email()) ->from('staging@example.com') ->to('anyone@example.com') ->subject('Sandbox check') ->text('Hello from Symfony.'); $mailer->send($email);
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
Messenger routing
If
framework.messengerroutesSendEmailMessageto a transport, mail leaves only when a consumer runs:php bin/console messenger:consume async.MAILER_DSN in .env.local
MAILER_DSN=null://nullin.env.localor.env.devwins over.env, and every message is dropped silently. Check those files when nothing shows up here.
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
- 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