Category: Laravel

Sometimes it's very helpful to debug all your outgoing emails -or part of them- from your Laravel app, especially in the early stage of the product's release. Please note: this method is good only if you have a small number of outgoing emails. NEVER run this on a large scale or in a production environment since most providers (such as AWS) charges you for sending emails to BCC users as a separate email for each recipient.

You may register an event listener (let's call it MessageSendingListener) for this events in your EventServiceProvider as follow: Now, create the listener by running: Then, add the following code to your listener: If you notice, I added the env check DEBUG_EMAILS to make it easier to stop/resume debugging outgoings emails. To activate sending BCC emails, just add the following key to your .env file.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Community Partners