how can I use default email template Laravel in my function Mail send?
Mail::send('default template?', $data, function($message) use($data) {
$message->to($data['email']);
$message->subject('New email!!!');
});
Do I need to create a new template? By why I can't use default email template? I can edit default template in resources/vendor/mail/html . Please help me use default email template.
I don't think the template you are referencing is a Laravel mail template. There are a few ways you can use Laravel's default mail templates. You can create a mailable class and build the email up using Laravel's pre-built email markdown, or you can create another blade template which you reference like any other blade template within Laravel.
Steps:
Mail::send('mail.default', $data, function($message) use($data) {
$message->to($data['email']);
$message->subject('New email!!!');
});
OR
In Laravel, each type of email sent by your application is represented as a "mailable" class. These classes are stored in the app/Mail directory. Don't worry if you don't see this directory in your application, since it will be generated for you when you create your first mailable class using the make:mail
command:
php artisan make:mail OrderShipped
Markdown mailable messages allow you to take advantage of the pre-built templates and components of mail notifications in your mailables. Since the messages are written in Markdown, Laravel is able to render beautiful, responsive HTML templates for the messages while also automatically generating a plain-text counterpart.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With