Debug blade views in Laravel Mailables

Debugging emails can be cumbersome, especially if you don't know the exact data that a Mailable gets or which Blade views your application uses to render an email. HELO provides a helper package for Laravel that adds additional debug information to every email and makes debugging your emails as easy as it gets.

Install the HELO helper package

You can install the helper package via composer by running:

composer require --dev beyondcode/helo-laravel

Configure HELO

If you haven't already configured your application to use HELO as email provider, the configuration is straight forward: Set your mailer to SMTP on your local machine and you are ready to go. Using a username for the SMTP authentication creates a unique mailbox in HELO and makes it easy to separate emails between different applications. You can have as many inboxes as you need.

MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=HELO-Demo
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=support@beyondco.de
MAIL_FROM_NAME="${APP_NAME}"

This is all you need to do to feed debug information into the debug tab of HELO. This is how it looks like:

HELO email debug information

If you are tired of triggering the email by going through the same process of your application over and over again, you can use Tinkerwell:

$body = 'This is a test message';

Mail::to(new User(['email' => 'test@beyondco.de']))->send(
    new App\Mail\MarkdownTestMail($body)
);

You can get HELO here.

Want product news
and updates?

Sign up for the Beyond Code newsletter to stay up to date.
© 2020 Beyond Code GmbH. All rights reserved.