judge2020 / laravel-amp-email-mailable
(Not for production use!) Adds support for AMPHTML email to laravel Mailables.
dev-master
2019-03-27 02:01 UTC
Requires
- laravel/framework: ^5.7
Requires (Dev)
- vlucas/phpdotenv: ^2.2
This package is auto-updated.
Last update: 2025-02-27 14:51:20 UTC
README
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)