How to define a HTML template for all WordPress emails?

Share

Let’s just say it honestly, wordpress’s default emails are not as so beautifull and that’s normal because they are in text format. If you’re running a professionnal website, you probably want to brand and format every outgoing emails generated by your wordpress installation. In order to achieve that, you need to define a HTML template for all WordPress emails.

First we create our standard HTML mail template. You can find many free ready to use responsive templates online. Then all the variable areas of our template will be replaced by placeholders so that every time a mail is sent, the placeholders will be replaced by their proper values.

Let’s say for example that our template will contain 2 placeholders:[title]: which will be replaced by the mail subject[content]: which will be replaced by the mail message.

All these snippets can be added in your theme’s our child theme’s functions.php file.