Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(