The docs are always a good place to start: https://laravel.com/docs/5.3/mail
Sending Email in Laravel
Hi all, i am newbie to laravel, i want to develop email module in laravel it can be used thoughout the application.
say, ecommerce website it will send mail while registration. while order the goods, etc,
i need an advice regarding
- is saving html mail body in DB is good over creating mail body as view?
- which laravel functionality is good to implement sending mail module thoughout the app?
What I do for dynamicly creating templates is save the form input as a file. To keep with view process provided by defaults I save them in views/email. Though technically you can save where ever. With blade.php at the end of the file name.
Save the file location, file name and meta data (name, use etc..) in a db table. When you fire off an email use the file name variable as the view and use any dynamic data as per the docs.
When a user updates, I find it easier to replace the file (delete current and save new).
Please or to participate in this conversation.