# megapis-mailgun-email

> Megapis worker to send email using mailgun

Latest version **0.0.1** (published 2016-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install megapis-mailgun-email
pnpm add megapis-mailgun-email
yarn add megapis-mailgun-email
bun add megapis-mailgun-email
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2016-07-17 |
| First published | 2016-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Kimberly Nicholls |
| Maintainers | kielni |
| Keywords | megapis, agent |

## Links

- npm: https://www.npmjs.com/package/megapis-mailgun-email
- Repository: https://github.com/kielni/megapis
- Issues: https://github.com/kielni/megapis/issues
- npm.io page: https://npm.io/package/megapis-mailgun-email

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) ^4.13.1
- [log4js](https://npm.io/package/log4js.md) ^0.6.22
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.5
- [mailgun-js](https://npm.io/package/mailgun-js.md) ^0.7.11
- [megapis-worker](https://npm.io/package/megapis-worker.md) ^0.1.0

## Recent versions

- 0.0.1 (latest) — 2016-07-17

## README

# Send email using mailgun

Gets values to send from `config.id` key; group values by their`source` property.
For each source, load `email_*source*.hbs` Handlebars template, merge with each
value, and append results to a string.

For example, the low tide worker saves its results to the `lowTide` key, and the
`email_lowTide.hbs` template outputs a div for each low tide with the level,
date, and time:

````
<div>
    {{level}} low tide - {{date}} @ {{time}}
</div>
````

Create an array of objects with source and html properties:

````
[
    {
        "source": "lowTide",
        "html" : "<div>\n    -0.1 low tide - 03/06 @ 9:00am\n</div>"
    },
    ...
]
````

Set `sources` to array of source and html objects, and merge with
`*config.id*.hbs*` to produce a message.

````
{{#each sources}}
    <h4>{{source}}</h4>
    <div>
        {{{html}}}
    </div>
{{/each}}
````

If there is something to send, send an email via Handlebars using 
the API key in `config.mailgun.apiKey` and domain in `config.mailgun.domain`.

---
_Source: https://npm.io/package/megapis-mailgun-email · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
