Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/benoitclaveau/qwebs-nodemailer

Send e-mail with your Qwebs server
https://github.com/benoitclaveau/qwebs-nodemailer

Last synced: 19 days ago
JSON representation

Send e-mail with your Qwebs server

Awesome Lists containing this project

README

        

# qwebs-nodemailer
Use [nodemailer](https://www.npmjs.com/package/nodemailer) to send email from your [Qwebs server](https://www.npmjs.com/package/qwebs).

## Features

* [Qwebs](https://www.npmjs.com/package/qwebs)
* [Nodemailer](https://www.npmjs.com/package/nodemailer)
* [Promise](https://www.npmjs.com/package/q)

### Add the nodemailer parameters in config.json

```json
{
"nodemailer": {
"transport": {
"service": "service name",
"auth": {
"user": "user",
"pass": "password"
}
},
"dkim": {
"domainName": "your domain.com",
"keySelector": "123456",
"privateKey": "./key.pem"
},
"from": "your e-mail address"
}
```

### Declare and inject $mailer

```js
const Qwebs = require("qwebs");
const qwebs = new Qwebs();

qwebs.inject("$mailer", "qwebs-nodemailer");
```

## API

* send(mailerOptions)

```js
let mailOptions = {
from: 'Fred Foo ✔ ', // sender address
to: '[email protected], [email protected]', // list of receivers
subject: 'Hello ✔', // Subject line
text: 'Hello world ✔', // plaintext body
html: 'Hello world ✔' // html body
};

return $mailer.send(mailOptions);
```

## Installation

```bash
$ npm install qwebs-nodemailer
```