Compare commits
13 Commits
xo-server-
...
xo-server-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92c4dda801 | ||
|
|
3e59ba4563 | ||
|
|
99c95626df | ||
|
|
20a9fc2497 | ||
|
|
9b3668423e | ||
|
|
3c11f0acda | ||
|
|
588c369615 | ||
|
|
14156b0911 | ||
|
|
1fd91de50d | ||
|
|
7587458f99 | ||
|
|
6980e2b959 | ||
|
|
f49f3fb2a6 | ||
|
|
6b82cc7510 |
@@ -1,6 +1,7 @@
|
||||
/.nyc_output/
|
||||
/dist/
|
||||
/node_modules/
|
||||
|
||||
npm-debug.log
|
||||
npm-debug.log.*
|
||||
pnpm-debug.log
|
||||
pnpm-debug.log.*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 'stable'
|
||||
- '4'
|
||||
- '0.12'
|
||||
- stable
|
||||
- 6
|
||||
- 4
|
||||
|
||||
# Use containers.
|
||||
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# xo-server-transport-email [](https://travis-ci.org/vatesfr/xo-server-transport-email)
|
||||
|
||||
> ${pkg.description}
|
||||
> xo-server plugin to send emails
|
||||
|
||||
## Install
|
||||
|
||||
Installation of the [npm package](https://npmjs.org/package/xo-server-transport-email):
|
||||
|
||||
```
|
||||
> npm install --global xo-server-auth-email
|
||||
> npm install --global xo-server-transport-email
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -17,24 +17,21 @@ the web iterface, see [the plugin documentation](https://xen-orchestra.com/docs/
|
||||
|
||||
## Development
|
||||
|
||||
### Installing dependencies
|
||||
|
||||
```
|
||||
# Install dependencies
|
||||
> npm install
|
||||
```
|
||||
|
||||
### Compilation
|
||||
# Run the tests
|
||||
> npm test
|
||||
|
||||
The sources files are watched and automatically recompiled on changes.
|
||||
|
||||
```
|
||||
# Continuously compile
|
||||
> npm run dev
|
||||
```
|
||||
|
||||
### Tests
|
||||
# Continuously run the tests
|
||||
> npm run dev-test
|
||||
|
||||
```
|
||||
> npm run test-dev
|
||||
# Build for production (automatically called by npm install)
|
||||
> npm run build
|
||||
```
|
||||
|
||||
## Contributions
|
||||
@@ -44,7 +41,7 @@ the code.
|
||||
|
||||
You may:
|
||||
|
||||
- report any [issue](https://google.com/vatesfr/xo-server-transport-email/issues)
|
||||
- report any [issue](https://github.com/vatesfr/xo-server-transport-email/issues)
|
||||
you've encountered;
|
||||
- fork and create a pull request.
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
{
|
||||
"name": "xo-server-transport-email",
|
||||
"version": "0.1.0",
|
||||
"version": "0.3.0",
|
||||
"license": "AGPL-3.0",
|
||||
"description": "",
|
||||
"description": "xo-server plugin to send emails",
|
||||
"keywords": [
|
||||
"xo-server",
|
||||
"email",
|
||||
"mail"
|
||||
"mail",
|
||||
"orchestra",
|
||||
"xen",
|
||||
"xen-orchestra",
|
||||
"xo-server"
|
||||
],
|
||||
"homepage": "https://google.com/vatesfr/xo-server-transport-email",
|
||||
"bugs": "https://google.com/vatesfr/xo-server-transport-email/issues",
|
||||
"homepage": "https://github.com/vatesfr/xo-server-transport-email",
|
||||
"bugs": "https://github.com/vatesfr/xo-server-transport-email/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://google.com/vatesfr/xo-server-transport-email"
|
||||
"url": "https://github.com/vatesfr/xo-server-transport-email"
|
||||
},
|
||||
"author": {
|
||||
"name": "Julien Fontanet",
|
||||
@@ -25,34 +28,46 @@
|
||||
"dist/"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
"node": ">=4"
|
||||
},
|
||||
"dependencies": {
|
||||
"nodemailer": "^2.4.2",
|
||||
"nodemailer-markdown": "^1.0.0",
|
||||
"promise-toolbox": "^0.4.0"
|
||||
"promise-toolbox": "^0.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.10.1",
|
||||
"babel-eslint": "^6.1.0",
|
||||
"babel-preset-es2015": "^6.9.0",
|
||||
"babel-preset-stage-0": "^6.5.0",
|
||||
"dependency-check": "^2.5.1",
|
||||
"ghooks": "^1.2.4",
|
||||
"standard": "^7.1.2"
|
||||
"babel-cli": "^6.18.0",
|
||||
"babel-eslint": "^7.1.1",
|
||||
"babel-preset-env": "^0.0.8",
|
||||
"babel-preset-stage-0": "^6.16.0",
|
||||
"cross-env": "^3.1.3",
|
||||
"dependency-check": "^2.6.0",
|
||||
"ghooks": "^1.3.2",
|
||||
"rimraf": "^2.5.4",
|
||||
"standard": "^8.5.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
|
||||
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
|
||||
"clean": "rimraf dist/",
|
||||
"depcheck": "dependency-check ./package.json",
|
||||
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
|
||||
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
|
||||
"lint": "standard",
|
||||
"posttest": "npm run lint && npm run depcheck",
|
||||
"prebuild": "npm run clean",
|
||||
"predev": "npm run clean",
|
||||
"prepublish": "npm run build"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
"stage-0",
|
||||
"es2015"
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"targets": {
|
||||
"node": 4
|
||||
}
|
||||
}
|
||||
],
|
||||
"stage-0"
|
||||
]
|
||||
},
|
||||
"standard": {
|
||||
|
||||
@@ -93,10 +93,24 @@ export const configurationSchema = {
|
||||
required: ['from', 'transport']
|
||||
}
|
||||
|
||||
export const testSchema = {
|
||||
type: 'object',
|
||||
|
||||
properties: {
|
||||
to: {
|
||||
type: 'string',
|
||||
description: 'recipient of the test mail'
|
||||
}
|
||||
},
|
||||
|
||||
additionalProperties: false,
|
||||
required: ['to']
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class TransportEmailPlugin {
|
||||
constructor (xo) {
|
||||
constructor ({ xo }) {
|
||||
this._sendEmail = ::this._sendEmail
|
||||
this._set = ::xo.defineProperty
|
||||
this._unset = null
|
||||
@@ -130,7 +144,7 @@ class TransportEmailPlugin {
|
||||
transport.use('compile', markdownCompiler)
|
||||
|
||||
this._conf = conf
|
||||
this._send = transport.sendMail::promisify(transport)
|
||||
this._send = promisify(transport.sendMail, transport)
|
||||
}
|
||||
|
||||
load () {
|
||||
@@ -141,6 +155,16 @@ class TransportEmailPlugin {
|
||||
this._unset()
|
||||
}
|
||||
|
||||
test ({to}) {
|
||||
return this._sendEmail({
|
||||
to,
|
||||
subject: '[Xen Orchestra] Test of transport-email plugin',
|
||||
markdown: `Hi there,
|
||||
|
||||
The transport-email plugin for Xen Orchestra server seems to be working fine, nicely done :)`
|
||||
})
|
||||
}
|
||||
|
||||
_sendEmail ({
|
||||
from = this._conf.from,
|
||||
to, cc, bcc,
|
||||
@@ -150,7 +174,9 @@ class TransportEmailPlugin {
|
||||
// TODO: handle errors
|
||||
return this._send({
|
||||
from,
|
||||
to, cc, bcc,
|
||||
to,
|
||||
cc,
|
||||
bcc,
|
||||
subject,
|
||||
markdown
|
||||
}).catch(logAndRethrow)
|
||||
@@ -159,4 +185,4 @@ class TransportEmailPlugin {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
export default ({ xo }) => new TransportEmailPlugin(xo)
|
||||
export default opts => new TransportEmailPlugin(opts)
|
||||
|
||||
Reference in New Issue
Block a user