Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lang-ai/react-emails
Create and render emails on the server with React
https://github.com/lang-ai/react-emails
emails react server-side-rendering
Last synced: 2 days ago
JSON representation
Create and render emails on the server with React
- Host: GitHub
- URL: https://github.com/lang-ai/react-emails
- Owner: lang-ai
- License: mit
- Created: 2017-04-25T11:23:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T09:31:33.000Z (over 3 years ago)
- Last Synced: 2024-08-04T01:15:23.259Z (3 months ago)
- Topics: emails, react, server-side-rendering
- Language: JavaScript
- Size: 616 KB
- Stars: 145
- Watchers: 7
- Forks: 35
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-email-marketing - Generating Emails with React
README
# 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](https://building.lang.ai/how-to-build-emails-with-react-fcf941b125d1).> If you want to generate PDFs using react, check the [react-pdfs](https://github.com/lang-ai/react-pdfs) repo.
### Example
To provide an example as starting point, this project generates a weather
forecast by using the [MetaWeather API][metaweather].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](https://s3-eu-west-1.amazonaws.com/sentisis-images/github_public/react-emails/email-preview.png)
### Development
This project was bootstrapped with [Create React App][react-create-app].
See the development guide [here][react-create-app-guide].### 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.```js
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](https://s3-eu-west-1.amazonaws.com/langai-public/github/logo-small.png)][langai]
**Built with ❤️ by Lang.ai**
[article]: https://building.sentisis.com/
[langai]: https://building.lang.ai/
[react-create-app]: https://github.com/facebookincubator/create-react-app
[react-create-app-guide]: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md
[metaweather]: https://www.metaweather.com/api/