Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.81 KB

README.md

File metadata and controls

50 lines (39 loc) · 1.81 KB

Email Templates

This folder contains HTML templates for transactional email, each template in its own folder. For example:

.
├── /welcome/                   # The email template for sending a welcome message
│   ├── /html.hbs               # The HTML version of the message
│   └── /subject.hbs            # The subject of the email
└── layout.hbs                  # Layout markup (header, footer etc.)

For testing purposes, there is /emails/:template endpoint (see src/app.js) that you can use for testing these templates in a browser. For example, in order to see how the welcome template renders in a browser simply navigate to:

https://localhost:8080/emails/welcome

All the templates in this folder are pre-compiled at build time (see tools/build.js) and consumed by the email component (see src/email.js).

Usage example:

import email from './email';

app.get('/test', async (req, res) => {
  const message = email.render('welcome', { t: req.t });
  await email.send(message, { to: '[email protected]' });
  res.send('Sent');
});

For more information please visit: