<commit_before>#mailgun-es6
[![npm version](https://badge.fury.io/js/mailgun-es6.svg)](http://badge.fury.io/js/mailgun-es6) &nbsp; [![Build Status](https://travis-ci.org/gpit2286/mailgun-es6.svg)](https://travis-ci.org/gpit2286/mailgun-es6)

The goal of this is to create an up-to-date library that interacts with the Mailgun API using only native JS modules.  It uses ES6 Classes and other features which requires it to be ran with the --harmony flag on node or with iojs.  When they merge this shouldn't be an issue. mailgun-es6 is MIT licensed.

## Installation

```sh
$ npm install mailgun-es6
```

## Set Up
```js
var MailGun = require('mailgun-es6');
var mailGun = new MailGun({
  privateApi: 'Your Private API Key',
  publicApi: 'Your Public API Key',
  domainName: 'The domain on your account'
});
```

## Usage

### Messages

#### Sending Messages - [POST /\[domain\]/messages](https://documentation.mailgun.com/api-sending.html#sending)
```js
mailGun.sendEmail({
  to: ['<EMAIL>', '<EMAIL>', '<EMAIL>'],
  from: '<EMAIL>',
  subject: 'Email Subject',
  body: 'Email Text',
  attachment: {
    fType: 'text/plain',
    fLoc: __dirname + '/LICENSE'
  }
}[, domainName]);
```
##### Returns
```js
promise(MailGun_Response, Rejection_Message)
```

The four required fields are above.  Any valid Mailgun options can be passed here in addition to these 4 fields. The Domain name passed in the function will supersede the default domain name if specified. The Mailgun descriptions are below along with the current limitations of this library.


| Parameter | Description |
| --- | --- |
| to | Email address of the recipient(s). Example: "Bob <<EMAIL>>". You can use commas to separate multiple recipients. Although 'to' is the only required string, you can also submit 'cc' and 'bcc' |
| html  | An HTML version of the message you are sending |
| o:tag	| Tag string. See [Tagging](https://documentation.mailgun.com/user_manual.html#tagging) for more information. |
| o:campaign	| Id of the campaign the message belongs to. See [Campaign Analytics](https://documentation.mailgun.com/user_manual.html#um-campaign-analytics) for details. |
| o:deliverytime	| Desired time of delivery. See [Date Format](https://documentation.mailgun.com/api-intro.html#date-format). Note: Messages can be scheduled for a maximum of 3 days in the future. |
| o:dkim	| Enables/disabled DKIM signatures on per-message basis. Pass yes or no |
| o:testmode	 | Enables sending in test mode. Pass yes if needed. See [Sending in Test Mode](https://documentation.mailgun.com/user_manual.html#manual-testmode) |
| o:tracking | Toggles tracking on a per-message basis, see [Tracking Messages](https://documentation.mailgun.com/user_manual.html#tracking-messages) for details. Pass yes or no. |
| o:tracking-clicks	| Toggles clicks tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes, no or htmlonly. |
| o:tracking-opens	| Toggles opens tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes or no. |<commit_msg>Fixed docs to correctly say 'text' and not 'body' Closes #7<commit_after>#mailgun-es6
[![npm version](https://badge.fury.io/js/mailgun-es6.svg)](http://badge.fury.io/js/mailgun-es6) &nbsp; [![Build Status](https://travis-ci.org/gpit2286/mailgun-es6.svg)](https://travis-ci.org/gpit2286/mailgun-es6)

The goal of this is to create an up-to-date library that interacts with the Mailgun API using only native JS modules.  It uses ES6 Classes and other features which requires it to be ran with the --harmony flag on node or with iojs.  When they merge this shouldn't be an issue. mailgun-es6 is MIT licensed.

## Installation

```sh
$ npm install mailgun-es6
```

## Set Up
```js
var MailGun = require('mailgun-es6');
var mailGun = new MailGun({
  privateApi: 'Your Private API Key',
  publicApi: 'Your Public API Key',
  domainName: 'The domain on your account'
});
```

## Usage

### Messages

#### Sending Messages - [POST /\[domain\]/messages](https://documentation.mailgun.com/api-sending.html#sending)
```js
mailGun.sendEmail({
  to: ['<EMAIL>', '<EMAIL>', '<EMAIL>'],
  from: '<EMAIL>',
  subject: 'Email Subject',
  text: 'Email Text',
  attachment: {
    fType: 'text/plain',
    fLoc: __dirname + '/LICENSE'
  }
}[, domainName]);
```
##### Returns
```js
promise(MailGun_Response, Rejection_Message)
```

The four required fields are above.  Any valid Mailgun options can be passed here in addition to these 4 fields. The Domain name passed in the function will supersede the default domain name if specified. The Mailgun descriptions are below along with the current limitations of this library.


| Parameter | Description |
| --- | --- |
| to | Email address of the recipient(s). Example: "Bob <<EMAIL>>". You can use commas to separate multiple recipients. Although 'to' is the only required string, you can also submit 'cc' and 'bcc' |
| html  | An HTML version of the message you are sending |
| o:tag	| Tag string. See [Tagging](https://documentation.mailgun.com/user_manual.html#tagging) for more information. |
| o:campaign	| Id of the campaign the message belongs to. See [Campaign Analytics](https://documentation.mailgun.com/user_manual.html#um-campaign-analytics) for details. |
| o:deliverytime	| Desired time of delivery. See [Date Format](https://documentation.mailgun.com/api-intro.html#date-format). Note: Messages can be scheduled for a maximum of 3 days in the future. |
| o:dkim	| Enables/disabled DKIM signatures on per-message basis. Pass yes or no |
| o:testmode	 | Enables sending in test mode. Pass yes if needed. See [Sending in Test Mode](https://documentation.mailgun.com/user_manual.html#manual-testmode) |
| o:tracking | Toggles tracking on a per-message basis, see [Tracking Messages](https://documentation.mailgun.com/user_manual.html#tracking-messages) for details. Pass yes or no. |
| o:tracking-clicks	| Toggles clicks tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes, no or htmlonly. |
| o:tracking-opens	| Toggles opens tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes or no. |
{'fraction_non_alphanumeric': 0.12524366471734893, 'fraction_numerical': 0.006335282651072124, 'mean_word_length': 4.377292576419214, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4949386', 'n_tokens_mistral': 1956, 'n_tokens_neox': 1858, 'n_words': 684}