Skip to content

Latest commit

 

History

History
67 lines (42 loc) · 1.83 KB

README.md

File metadata and controls

67 lines (42 loc) · 1.83 KB

This respository is no longer maintained


Generating Emails with React

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.

Example

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:

Email preview

Development

This project was bootstrapped with Create React App. See the development guide here.

Creating the email

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
  });

LangAI

Built with ❤️ by Lang.ai