# co-juice-mailer

> CompoundJS extension for sending emails

Latest version **0.0.6** (published 2013-04-19) · 0 weekly downloads

## Install

```sh
npm install co-juice-mailer
pnpm add co-juice-mailer
yarn add co-juice-mailer
bun add co-juice-mailer
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2013-04-19 |
| First published | 2013-03-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrew Krasnoff |
| Maintainers | bioform |
| Keywords | mailer, compound |

## Links

- npm: https://www.npmjs.com/package/co-juice-mailer
- Repository: https://github.com/bioform/co-juice-mailer
- npm.io page: https://npm.io/package/co-juice-mailer

## Dependencies (4)

- [yaml](https://npm.io/package/yaml.md) >=0.1.2
- [lodash](https://npm.io/package/lodash.md) latest
- [nodemailer](https://npm.io/package/nodemailer.md) >=0.1.11
- [swig-email-templates](https://npm.io/package/swig-email-templates.md) >=0.4.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2013-04-19
- 0.0.5 — 2013-04-18
- 0.0.4 — 2013-04-08
- 0.0.3 — 2013-03-21
- 0.0.2 — 2013-03-18
- 0.0.1 — 2013-03-18

## README

About
-----

It is simple mailer for [compound.js](https://github.com/1602/compound) project.
It based on [nademailer](https://github.com/andris9/Nodemailer) and [swig-email-templates](https://github.com/superjoe30/swig-email-templates) npms.

Features
--------

 * Uses [swig](https://github.com/paularmstrong/swig/), which supports
   [Django-inspired template inheritance](https://docs.djangoproject.com/en/dev/topics/templates/#template-inheritance).
 * Uses [juice](https://github.com/LearnBoost/juice), which takes an HTML
   file and inlines all the `<link rel="stylesheet">`s and the `<style>`s.
 * Uses [swig-dummy-context](https://github.com/superjoe30/swig-dummy-context)
   which gives you the ability to generate dummy context from a template to
   aid in an email preview tool.
 * URL rewrite support - you can provide a `urlRewriteFn` argument to rewrite
   your links.

Installation
------------

Put the following dependence to your package.json file

    "co-juice-mailer":     "latest"

Add this package to "/config/autoload.js" file
    
And run:
    
    npm install -l
    
Place "mailer.yml" to your application "config" folder:

    development:
      mailer: smtp
      url: "http://localhost:8888"
      from: "no-reply@example.com"
      host: "smtp.gmail.com"
      port: 587
      use_authentication: true
      user: "no-reply@example.com"
      pass: "password"
    
    production:
      mailer: smtp
      url: "http://example.com"
      from: "no-reply@example.com"
      host: "smtp.gmail.com"
      port: 587
      use_authentication: true
      user: "no-reply@example.com"
      pass: "password"
    
    test:
      mailer: test
      url: "http://localhost:8888"
      from: "no-reply@example.com"
    


Usage
-----

Put you email views into the `app/views/` directory with following naming style:

    templatename.html

When you want to send email, just call

    callback = function(err, success){
        if( success ){
            console.log('email was sent')
        } else {
            console.log('Error: ' + err)
        }
    };
    compound.mailer.send( 'relative_path/templatename', {name: 'my var for template context'},
        {subject: 'Email subject', email: 'recipient@example.com', from: 'me@home'}, callback)

Controller have `sendEmail` method with the same signature.

The following variables will be available in the email template context:

 - url - from your config file
 - pathTo - compoundjs helper to use named routes

Besides, default value for "from" option can be configured via "mailer.yml" file too.

Swig filters
------------

If you want to use your own swig filters - put it to "/app/swig/filters.js" file (or "/app/swig/filters.coffee")

See [Swig Variable Filters](http://paularmstrong.github.io/swig/docs/#filters)

License
-------

MIT

Contribution
------------

Contributors are welcome

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