Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mohammed-H's avatar

E-mail Templates

Hello I want to send e-mails rendered from templates that can be created / modifed by admin from a form (with placeholders). I guess that we can write to the views files. But can't find a lesson on how to do it.

Thanks for your help Mohammed

0 likes
7 replies
mstnorris's avatar

@Mohammed-H The Delivery lesson from the series Build Your First App is what you're after. The whole series is worth watching.

As for email templates themselves, they are no more than normal views except for the fact that you can't really reference external css and other resources. Everything has to be inline. And, in that vain, it is the norm to use tables for layouts etc.

You can readily download sample HTML email templates and modify them. That is what I do. The link I provided is to the 100+ Free Email Templates from Campaign Monitor; a quick Google search will yield tonnes more results.

Hope this helps.

2 likes
RachidLaasri's avatar

@Mohammed-H Just edit the view content from the admin panel, and when sending an email give it all the data it requires.

Mohammed-H's avatar

HI Guys Many thanks for your responds. @RachidLaasri the fact is that it is not me who is going to edit the e-mails. it's an admin. And i want to make it as simple as possible. Just fill-up a form with body using an editor and save it to the corresponding view. if you have a tuto on that please share Salam :) Mohammed

1 like
RachidLaasri's avatar

Unfortunately No, what i suggested is using the Laravel FileSystem to edit the view. Display the content of your view in an editor and replace the text with something like blade syntax.

Example :

Hi { { name } }, 

We are emailing you because { { reason } }...This will be the content of the message, you can insert HTML or anything you want.

Thank you. - { { sitename } }

Then replace these words with your variable that you will pass to the view while sending the email.

4 likes
ghoshriju33's avatar

@RachidLaasri I do exactly same thing 😄. Instead I use them like this: [__camelCasedName__]

Your's is much cleaner. I am definitely borrowing this.

Please or to participate in this conversation.