Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

How to use e-mail templates in Laravel?


Please help me to use mail templates of Metronic in Lavarel. Currently laravel is sending standard mails.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Hi David,

To use email templates in Laravel, you can use Laravel's built-in mail functionality along with Laravel's Blade templating engine. If you want to integrate Metronic's email templates into Laravel, you need to customize the default Laravel email templates to use Metronic styles and layouts.

Create Blade templates for your emails inside the resources/views/emails directory using Metronic email template from the HTML version. For example, you can create welcome.blade.php.

In your Laravel config/mail.php, set the markdown option to point to the new email layout template:

// config/mail.php
"markdown" => [
"theme" => "layouts.metronic.email",
],


When sending emails in Laravel, you can use Laravel's built-in notifications system. Update your notifications to use the new Blade email templates:

// For example, in a UserRegistered notification class
public function toMail($notifiable)
{
return (new MailMessage)
->subject("Welcome to our application")
->markdown("emails.welcome");
}



Hello, I have tried the solution you propose but it gives me this error: View [themes.layouts.metronic.email] not found.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(