Skip to content

Commit

Permalink
Merge branch 'release-3.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Aug 26, 2017
2 parents 3aa77c3 + 0855a5a commit 023e246
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="3.0.1"></a>
## [3.0.1](https://github.com/adonisjs/adonis-mail/compare/v3.0.0...v3.0.1) (2017-08-26)


### Features

* **mail:** proxy mailsender methods ([01c19c9](https://github.com/adonisjs/adonis-mail/commit/01c19c9))



<a name="3.0.0"></a>
# [3.0.0](https://github.com/adonisjs/adonis-mail/compare/v2.0.2...v3.0.0) (2017-08-26)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adonisjs/mail",
"version": "3.0.0",
"version": "3.0.1",
"description": "Mail provider for adonis framework and has support for all common mailing services to send emails",
"main": "index.js",
"directories": {
Expand Down
1 change: 1 addition & 0 deletions providers/MailProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class MailProvider extends ServiceProvider {
const Mail = require('../src/Mail')
return new Mail(Config, View)
})
this.app.alias('Adonis/Addons/Mail', 'Mail')
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/Mail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

const GE = require('@adonisjs/generic-exceptions')
const MailManager = require('./Manager')
const proxyMethods = ['send', 'raw']

/**
* The mail class is used to grab an instance of
Expand All @@ -29,6 +30,9 @@ class Mail {
this._sendersPool = {}
}

send () {
}

/**
* Returns an instance of a mail connection. Also this
* method will cache the connection for re-usability.
Expand Down Expand Up @@ -81,4 +85,10 @@ class Mail {
}
}

proxyMethods.forEach((method) => {
Mail.prototype[method] = function (...params) {
return this.connection()[method](...params)
}
})

module.exports = Mail
11 changes: 11 additions & 0 deletions test/mail.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,15 @@ test.group('Mail', () => {
const smtp1 = mail.connection('smtp')
assert.deepEqual(smtp, smtp1)
})

test('proxy sender methods', (assert) => {
const config = new Config()
config.set('mail.connection', 'smtp')
config.set('mail.smtp', {
driver: 'smtp'
})
const mail = new Mail(config)
assert.isFunction(mail.send)
assert.isFunction(mail.raw)
})
})

0 comments on commit 023e246

Please sign in to comment.