Compare commits

...

22 Commits

Author SHA1 Message Date
Julien Fontanet
090d48b636 0.3.2 2017-01-12 17:13:55 +01:00
Julien Fontanet
55567bf666 fix(package): use nodemailer 2.6.4
nodemailer 2.7.0 breaks Node 4 compatibility
2017-01-12 17:13:51 +01:00
Julien Fontanet
5867d84eaa 0.3.1 2017-01-12 16:24:45 +01:00
Julien Fontanet
4d8f1ab169 chore(package): update all dependencies 2017-01-12 16:23:21 +01:00
Julien Fontanet
6a2963be41 chore(configuration schema): add description for from.name and from.address 2017-01-12 16:17:55 +01:00
greenkeeper[bot]
fdd33abe91 fix(package): update promise-toolbox to version 0.8.0 (#14)
https://greenkeeper.io/
2017-01-06 11:31:53 +01:00
badrAZ
81062638eb feat: attachments support (#13) 2016-12-22 10:09:15 +01:00
greenkeeper[bot]
4530d95f48 chore(package): update babel-preset-env to version 1.0.0 (#11)
https://greenkeeper.io/
2016-12-09 22:52:58 +01:00
greenkeeper[bot]
5e86e64e18 chore(package): update babel-preset-env to version 0.0.9 (#10)
https://greenkeeper.io/
2016-11-24 22:04:27 +01:00
Julien Fontanet
92c4dda801 0.3.0 2016-11-23 09:57:41 +01:00
Julien Fontanet
3e59ba4563 chore(package): update all dependencies 2016-11-23 09:57:23 +01:00
Julien Fontanet
99c95626df chore: pass options directly to the constructor 2016-11-23 09:49:27 +01:00
Julien Fontanet
20a9fc2497 chore(package): add description 2016-11-23 09:48:07 +01:00
Julien Fontanet
9b3668423e 0.2.0 2016-11-10 10:47:43 +01:00
badrAZ
3c11f0acda feat(test): this plugin is now testable (#9)
See vatesfr/xo-web#1749
2016-11-09 14:55:08 +01:00
Julien Fontanet
588c369615 fix(package): fix URLs 2016-11-02 11:45:31 +01:00
Julien Fontanet
14156b0911 chore(package): update all dependencies 2016-10-28 11:54:51 +02:00
Greenkeeper
1fd91de50d chore(package): update promise-toolbox to version 0.7.0 (#8)
https://greenkeeper.io/
2016-10-24 15:03:35 +02:00
Greenkeeper
7587458f99 Update promise-toolbox to version 0.6.0 🚀 (#7)
https://greenkeeper.io/
2016-10-12 09:12:14 +02:00
Greenkeeper
6980e2b959 chore(package): update babel-eslint to version 7.0.0 (#4)
https://greenkeeper.io/
2016-09-27 23:37:03 +02:00
Greenkeeper
f49f3fb2a6 Update all dependencies 🌴 (#3)
https://greenkeeper.io/
2016-09-25 16:20:17 +02:00
Olivier Lambert
6b82cc7510 fix(readme): typo 2016-08-12 17:22:28 +02:00
8 changed files with 3709 additions and 64 deletions

View File

@@ -11,7 +11,7 @@ root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespaces = true
trim_trailing_whitespace = true
# CoffeeScript
#
@@ -28,12 +28,12 @@ indent_style = space
# Package.json
#
# This indentation style is the one used by npm.
[/package.json]
[package.json]
indent_size = 2
indent_style = space
# Jade
[*.jade]
# Pug (Jade)
[*.{jade,pug}]
indent_size = 2
indent_style = space
@@ -41,7 +41,7 @@ indent_style = space
#
# Two spaces seems to be the standard most common style, at least in
# Node.js (http://nodeguide.com/style.html#tabs-vs-spaces).
[*.js]
[*.{js,jsx,ts,tsx}]
indent_size = 2
indent_style = space

View File

@@ -1,6 +1,9 @@
/.nyc_output/
/coverage/
/dist/
/node_modules/
npm-debug.log
npm-debug.log.*
pnpm-debug.log
pnpm-debug.log.*
yarn-error.log

View File

@@ -1,10 +1,24 @@
/benchmark/
/benchmarks/
*.bench.js
*.bench.js.map
/examples/
example.js
example.js.map
*.example.js
*.example.js.map
/fixture/
/fixtures/
*.fixture.js
*.fixture.js.map
*.fixtures.js
*.fixtures.js.map
/test/
/tests/
*.spec.js
*.spec.js.map
__snapshots__/

View File

@@ -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/

View File

@@ -1,13 +1,13 @@
# xo-server-transport-email [![Build Status](https://travis-ci.org/vatesfr/xo-server-transport-email.png?branch=master)](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.

View File

@@ -1,18 +1,21 @@
{
"name": "xo-server-transport-email",
"version": "0.1.0",
"version": "0.3.2",
"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,45 +28,64 @@
"dist/"
],
"engines": {
"node": ">=0.12"
"node": ">=4"
},
"dependencies": {
"nodemailer": "^2.4.2",
"nodemailer-markdown": "^1.0.0",
"promise-toolbox": "^0.4.0"
"lodash": "^4.17.4",
"nodemailer": "2.6.4",
"nodemailer-markdown": "^1.0.1",
"promise-toolbox": "^0.8.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-plugin-lodash": "^3.2.11",
"babel-preset-env": "^1.1.8",
"babel-preset-stage-3": "^6.17.0",
"cross-env": "^3.1.4",
"dependency-check": "^2.7.0",
"husky": "^0.12.0",
"jest": "^18.1.0",
"rimraf": "^2.5.4",
"standard": "^8.6.0"
},
"scripts": {
"build": "NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"depcheck": "dependency-check ./package.json",
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
"lint": "standard",
"posttest": "npm run lint && npm run depcheck",
"prepublish": "npm run build"
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"commit-msg": "npm test",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"dev-test": "jest --bail --watch",
"posttest": "standard && dependency-check ./package.json",
"prebuild": "rimraf dist/",
"predev": "npm run prebuild",
"prepublish": "npm run build",
"test": "jest"
},
"babel": {
"plugins": [
"lodash"
],
"presets": [
"stage-0",
"es2015"
[
"env",
{
"targets": {
"node": 4
}
}
],
"stage-3"
]
},
"jest": {
"testPathDirs": [
"<rootDir>/src"
],
"testRegex": "\\.spec\\.js$"
},
"standard": {
"ignore": [
"dist"
],
"parser": "babel-eslint"
},
"config": {
"ghooks": {
"commit-msg": "npm test"
}
}
}

View File

@@ -1,3 +1,4 @@
import { bind } from 'lodash'
import { createTransport } from 'nodemailer'
import { markdown as nodemailerMarkdown } from 'nodemailer-markdown'
import { promisify } from 'promise-toolbox'
@@ -23,10 +24,12 @@ export const configurationSchema = {
properties: {
name: {
type: 'string'
type: 'string',
description: 'human readable name of the sender'
},
address: {
type: 'string'
type: 'string',
description: 'email address of the sender'
}
},
@@ -93,12 +96,26 @@ 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) {
this._sendEmail = ::this._sendEmail
this._set = ::xo.defineProperty
constructor ({ xo }) {
this._sendEmail = bind(this._sendEmail, this)
this._set = bind(xo.defineProperty, xo)
this._unset = null
// Defined in configure().
@@ -130,7 +147,7 @@ class TransportEmailPlugin {
transport.use('compile', markdownCompiler)
this._conf = conf
this._send = transport.sendMail::promisify(transport)
this._send = promisify(transport.sendMail, transport)
}
load () {
@@ -141,22 +158,36 @@ 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,
subject,
markdown
markdown,
attachments
}) {
// TODO: handle errors
return this._send({
from,
to, cc, bcc,
to,
cc,
bcc,
subject,
markdown
markdown,
attachments
}).catch(logAndRethrow)
}
}
// ===================================================================
export default ({ xo }) => new TransportEmailPlugin(xo)
export default opts => new TransportEmailPlugin(opts)

File diff suppressed because it is too large Load Diff