Appearance
Tips on testing email notifications
Send e-mails in test mode
We need to be able to send e-mails in test mode, because we should not deliver actual e-mails when not in production.
Mailgun
When using Mailgun, you need to use the same API key and define a parameter to say "we are in test mode".
- When testing using the SMTP method, a parameter named
X-Mailgun-Drop-Messageset totrueshould be defined as atext header. - When testing using the API method, send a parameter named
o:testmodeset totrue.
Sandbox
To use Mailgun’s sandbox ensure that you use the following parameters at your .env file:
text
MAIL_MAILER=mailgun
MAILGUN_DOMAIN=sandboxc641e0a6438d4fd88d8e3fba682fb09e.mailgun.org
MAILGUN_SECRET=key-3506f37612c8217122135be0b54ffcecWARNING
Be aware, Mailgun will send emails in sandbox mode only to emails from the list available at the https://mailgun.com/app/testing/recipients URL. For all other emails \Mail::send() method of Laravel’s Illuminate\Support\Facades\Mail facade will throw \GuzzleHttp\Exception\ClientException exception.
Related links
- Mail & Local Development (Laravel official documentation)