judge2020/laravel-amp-email-mailable

(Not for production use!) Adds support for AMPHTML email to laravel Mailables.

Downloads

3

Stars

0

Version

AMPHTML email for Laravel Mailable

NOTE: do not use this in production! This will not be maintained.

This impliments the text/x-amp-html multipart part required to use AMPHTML email.

I recommend waiting for this to be implemented in upstream Laravel. Feel free to visit my feature request.

usage

After installing, you should change your Mailable classes to extend AmpMailable instead.

before:


...
use Illuminate\Mail\Mailable;

class <class> extends Mailable
{

after:

use AmpEmail\AmpMailable;

class <class> extends AmpMailable;

Now, in your build function, chain the amp function. This takes the same arguments as view and text.

    public function build()
    {
        return $this->subject("EmailSubject")
            ->view('mail.emailview')
            ->text('mail.emailview_plain')
            ->amp('mail.emailview_amp');
            
    }

(Amp view names do not need to be suffixed by _amp, but it is recommended)

judge2020

Author

judge2020