<commit_before># revolutionuc-emails

[![MIT License](https://img.shields.io/github/license/revolutionuc/revolutionuc-emails.svg?maxAge=2592000)](LICENSE)
![stability-wip](https://img.shields.io/badge/stability-work_in_progress-yellow.svg)
[![Build Status](https://travis-ci.org/RevolutionUC/revolutionuc-emails.svg?branch=master)](https://travis-ci.org/RevolutionUC/revolutionuc-emails)
[![dependencies Status](https://david-dm.org/revolutionuc/revolutionuc-emails/status.svg)](https://david-dm.org/revolutionuc/revolutionuc-emails)
[![devDependencies Status](https://david-dm.org/revolutionuc/revolutionuc-emails/dev-status.svg)](https://david-dm.org/revolutionuc/revolutionuc-emails?type=dev)

> Transactional and marketing email templates and builder for RevolutionUC

## Usage

Install the module as a dependency with `npm install --save revolutionuc-emails`. Next, use the api to build emails:

### api

The api allows the creation of html and plain text based transactional emails (ex: Mailgun).

```javascript
const Email = require('revolutionuc-emails')

const email = new Email()
const template = 'welcome' // choose from templates in `./templates/`
const templateData = {
  subject: 'Email subject', // required
  shortDescription: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' // required, this is shown next to the subject in most email clients
}
email.build(template, templateData)
  .then(result => {
    console.log(result.html, result.text) // html and plain text version of the email
  })
  .catch(console.error)
```

or to send the email with Mailgun:

```javascript
// ...
const email = new Email(mailgunApiKey, mailgunDomain)
// ...
email.build(template, templateData, '<EMAIL>', '<EMAIL>')
  .then(console.log) // built email that was sent by mailgun
  .catch(console.error)
```
<commit_msg>Update sending email example in README.md<commit_after># revolutionuc-emails

[![MIT License](https://img.shields.io/github/license/revolutionuc/revolutionuc-emails.svg?maxAge=2592000)](LICENSE)
![stability-wip](https://img.shields.io/badge/stability-work_in_progress-yellow.svg)
[![Build Status](https://travis-ci.org/RevolutionUC/revolutionuc-emails.svg?branch=master)](https://travis-ci.org/RevolutionUC/revolutionuc-emails)
[![dependencies Status](https://david-dm.org/revolutionuc/revolutionuc-emails/status.svg)](https://david-dm.org/revolutionuc/revolutionuc-emails)
[![devDependencies Status](https://david-dm.org/revolutionuc/revolutionuc-emails/dev-status.svg)](https://david-dm.org/revolutionuc/revolutionuc-emails?type=dev)

> Transactional and marketing email templates and builder for RevolutionUC

## Usage

Install the module as a dependency with `npm install --save revolutionuc-emails`. Next, use the api to build emails:

### api

The api allows the creation of html and plain text based transactional emails (ex: Mailgun).

```javascript
const Email = require('revolutionuc-emails')

const email = new Email()
const template = 'welcome' // choose from templates in `./templates/`
const templateData = {
  subject: 'Email subject', // required
  shortDescription: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' // required, this is shown next to the subject in most email clients
}
email.build(template, templateData)
  .then(result => {
    console.log(result.html, result.text) // html and plain text version of the email
  })
  .catch(console.error)
```

or to send the email with Mailgun:

```javascript
// ...
const email = new Email(mailgunApiKey, mailgunDomain)
// ...
email.build(template, templateData, 'RevolutionUC <<EMAIL>>', '<EMAIL>')
  .then(console.log) // built email that was sent by mailgun
  .catch(console.error)
```

{'fraction_non_alphanumeric': 0.1393021368677306, 'fraction_numerical': 0.0037868542061130646, 'mean_word_length': 5.062295081967213, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 12, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5463855', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1144, 'n_words': 282}