nanuc/frontend-mail

There is no license information available for the latest version (1.0.1) of this package.

1.0.1 2021-08-02 16:22 UTC

This package is not auto-updated.

Last update: 2024-04-23 05:56:52 UTC


README

This package send mail to the frontend of Laravel aps. This is useful for demos on landing pages.

Installation

The package assumes that you have the stacks scripts and styles in your main Blade layout.

Install the package:

composer require nanuc/frontend-mail

Put the following somewhere in your views:

<x-frontend-mail />

Put the following in config/mail.php:

'mailers' => [
    // other mailers
    'frontend' => [
        'transport' => 'frontend',
    ],
]

Set your mailer to frontend in .env:

MAIL_MAILER=frontend

Session ID modification

You can change the ID that is used for the frontend in the Mailable. This is useful if you create mails outside of an user session.

class SomeMail extends Mailable
{
    public function build()
    {
        return $this->view('mails.some-mail')
            ->withSwiftMessage(function ($message){
                $message->getHeaders()->addTextHeader(
                    'Frontend-Mail-Id', $this->user->id
                );
            });
    }
}