Plain text emails are still very important these days. For many of them, however, it is pointless to write a plain text version as long as it can be automatically generated from HTML format.
1. Install html2text package:
composer require soundasleep/html2text
2. Create file TextMailBuilder.php:
This trait contains a buildView method that overwrites the original method and will generate text for the email only if you do not use your own view for the plain text version of the email.
Create Traits folder in app/Mails, then create TextMailBuilder.php file, then place the entire code to this file:
Top comments (0)