This is an example project you can use to generate emails with React. You can start by reading the article here.
If you want to generate PDFs using react, check the react-pdfs repo.
To provide an example as starting point, this project generates a weather forecast by using the MetaWeather API.
To generate the example email:
$ npm install
$ npm run build
$ node example/weather.js
The result html will be saved in the working directory. Here is what it looks like:
This project was bootstrapped with Create React App. See the development guide here.
To create the email, simply import the module and call the function with the data. It returns a promise that resolves to the full HTML template as a string.
const createEmail = require('react-emails-example');
const data = {
name: 'Alberto',
title: 'Demo email',
};
createEmail(data)
.then((html) => {
// Send the HTML with your email service of choice
});
Built with ❤️ by Lang.ai