Skip to content

Commit

Permalink
Merge branch 'release-3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Aug 26, 2017
2 parents 0aa0552 + 2c5e7f6 commit 3aa77c3
Show file tree
Hide file tree
Showing 58 changed files with 7,303 additions and 2,808 deletions.
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_HOST=smtp.mailtrap.io
SMTP_PORT=25
SMTP_FROM_EMAIL=
SMTP_TO_EMAIL=
MAILTRAP_TOKEN=
MAILTRAP_INBOX_ID=
SPARKPOST_API_KEY=
SPARKPOST_FROM_EMAIL=
MAILGUN_API_KEY=
MAILGUN_DOMAIN=
SES_KEY=
SES_SECRET=
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ coverage
node_modules
.DS_Store
npm-debug.log
.idea
out
.nyc_output
test/tmp
.env
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ test
.travis.yml
.editorconfig
benchmarks
.idea
bin
out
.nyc_output
.env
13 changes: 2 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
language: node_js
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
node_js:
- node
- 5.3.0
- 4.0.0
- 7.0.0
sudo: false
install:
- npm install --no-optional
- npm install
notifications:
slack:
secure: m91zkX2cLVDRDMBAUnR1d+hbZqtSHXLkuPencHadhJ3C3wm53Box8U25co/goAmjnW5HNJ1SMSIg+DojtgDhqTbReSh5gSbU0uU8YaF8smbvmUv3b2Q8PRCA7f6hQiea+a8+jAb7BOvwh66dV4Al/1DJ2b4tCjPuVuxQ96Wll7Pnj1S7yW/Hb8fQlr9wc+INXUZOe8erFin+508r5h1L4Xv0N5ZmNw+Gqvn2kPJD8f/YBPpx0AeZdDssTL0IOcol1+cDtDzMw5PAkGnqwamtxhnsw+i8OW4avFt1GrRNlz3eci5Cb3NQGjHxJf+JIALvBeSqkOEFJIFGqwAXMctJ9q8/7XyXk7jVFUg5+0Z74HIkBwdtLwi/BTyXMZAgsnDjndmR9HsuBP7OSTJF5/V7HCJZAaO9shEgS8DwR78owv9Fr5er5m9IMI+EgSH3qtb8iuuQaPtflbk+cPD3nmYbDqmPwkSCXcXRfq3IxdcV9hkiaAw52AIqqhnAXJWZfL6+Ct32i2mtSaov9FYtp/G0xb4tjrUAsDUd/AGmMJNEBVoHtP7mKjrVQ35cEtFwJr/8SmZxGvOaJXPaLs43dhXKa2tAGl11wF02d+Rz1HhbOoq9pJvJuqkLAVvRdBHUJrB4/hnTta5B0W5pe3mIgLw3AmOpk+s/H4hAP4Hp0gOWlPA=
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
<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)


### Bug Fixes

* **sender:** pass view instance to mail sender ([94b20f2](https://github.com/adonisjs/adonis-mail/commit/94b20f2))


### Features

* fresh new start ([1d57bb6](https://github.com/adonisjs/adonis-mail/commit/1d57bb6))
* rewrite for 4.0 ([62cecfa](https://github.com/adonisjs/adonis-mail/commit/62cecfa))
* **driver:** add mailgun driver ([99ff8ff](https://github.com/adonisjs/adonis-mail/commit/99ff8ff))
* **driver:** add Ses driver ([7d13d9e](https://github.com/adonisjs/adonis-mail/commit/7d13d9e))
* **driver:** add sparkpost driver ([76944b5](https://github.com/adonisjs/adonis-mail/commit/76944b5))
* **driver:** sparkpost now accepts extras for mail ([604650a](https://github.com/adonisjs/adonis-mail/commit/604650a))
* **driver:** write smtp driver ([e3d2832](https://github.com/adonisjs/adonis-mail/commit/e3d2832))
* **drivers:** drivers receives the config via `setConfig` method ([45911a3](https://github.com/adonisjs/adonis-mail/commit/45911a3))
* **instructions:** add instructions for `adonis install` ([83cc8d0](https://github.com/adonisjs/adonis-mail/commit/83cc8d0))
* **message:** allow sending driver extras ([91430c9](https://github.com/adonisjs/adonis-mail/commit/91430c9))
* **providers:** add providers ([3e43cde](https://github.com/adonisjs/adonis-mail/commit/3e43cde))



<a name="2.0.2"></a>
## [2.0.2](https://github.com/adonisjs/adonis-mail/compare/v2.0.1...v2.0.2) (2016-10-11)

Expand Down
110 changes: 74 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,94 @@
# Adonis Mail
# Adonis Mail 📩

[![Gitter](https://img.shields.io/badge/+%20GITTER-JOIN%20CHAT%20%E2%86%92-1DCE73.svg?style=flat-square)](https://gitter.im/adonisjs/adonis-framework)
[![Trello](https://img.shields.io/badge/TRELLO-%E2%86%92-89609E.svg?style=flat-square)](https://trello.com/b/yzpqCgdl/adonis-for-humans)
[![Version](https://img.shields.io/npm/v/adonis-mail-provider.svg?style=flat-square)](https://www.npmjs.com/package/adonis-mail-provider)
[![Build Status](https://img.shields.io/travis/adonisjs/adonis-mail/master.svg?style=flat-square)](https://travis-ci.org/adonisjs/adonis-mail)
[![Coverage Status](https://img.shields.io/coveralls/adonisjs/adonis-mail/master.svg?style=flat-square)](https://coveralls.io/github/adonisjs/adonis-mail?branch=master)
[![Downloads](https://img.shields.io/npm/dt/adonis-mail-provider.svg?style=flat-square)](https://www.npmjs.com/package/adonis-mail-provider)
[![License](https://img.shields.io/npm/l/adonis-mail-provider.svg?style=flat-square)](https://opensource.org/licenses/MIT)
This repo is a AdonisJs provider to send emails using one of the available drivers, or by writing your own driver.

> :pray: This repository contains email sending facilities for adonis framework.
It uses [node mailer](https://nodemailer.com) internally to parse and send emails.

Mail provider has support for several drivers to send email from your adonis app.
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Appveyor][appveyor-image]][appveyor-url]
[![Coveralls][coveralls-image]][coveralls-url]

1. SMTP
2. Amazon SES
3. Mandrill
4. Log ( for testing emails )
<img src="http://res.cloudinary.com/adonisjs/image/upload/q_100/v1497112678/adonis-purple_pzkmzt.svg" width="200px" align="right" hspace="30px" vspace="140px">

## Table of Contents
## What's in the box?

* [Team Members](#team-members)
* [Getting Started](#getting-started)
* [Contribution Guidelines](#contribution-guidelines)
This repo contains following providers.

## <a name="team-members"></a>Team Members
1. Consistent API to send email
2. Support for multiple drivers include **smtp**,**sparkmost**,**mailgun**,**amazon ses** etc.
3. API to add your own drivers
4. Write email content inside Edge templates.

* Harminder Virk ([Caffiene Blogging](http://amanvirk.me/)) <virk.officials@gmail.com>
## Node/OS Target

## <a name="getting-started"></a>Getting Started
This repo/branch is supposed to run fine on all major OS platforms and targets `Node.js >=7.0`

## Development

Great! If you are planning to contribute to the framework, make sure to adhere to following conventions, since a consistent code-base is always joy to work with.

Run the following command to see list of available npm scripts.

```bash
$ npm i --save adonis-mail-provider
```
npm run
```

## Environment Variables

There is a `.env.example` file in the project root, rename it as `.env` and add values for all services to run tests on your local.

DO MAKE SURE TO NOT COMMIT THE `.env` FILE.

### Tests & Linting

1. Lint your code using standardJs. Run `npm run lint` command to check if there are any linting errors.
2. Make sure you write tests for all the changes/bug fixes.
3. Also you can write **regression tests**, which shows that something is failing but doesn't breaks the build. Which is actually a nice way to show that something fails. Regression tests are written using `test.failing()` method.
4. Make sure all the tests are passing on `travis` and `appveyor`.

### General Practices

next register the provider in your `bootstrap/app.js` file.
Since Es6 is in, you should strive to use latest features. For example:

```bash
const providers = [
'adonis-mail-provider/providers/MailProvider'
]
1. Use `Spread` over `arguments` keyword.
2. Never use `bind` or `call`. After calling these methods, we cannot guarantee the scope of any methods and in AdonisJs codebase we do not override the methods scope.
3. Make sure to write proper docblock.

const aliases = {
Mail: 'Adonis/Addons/Mail'
}
## Issues & PR

It is always helpful if we try to follow certain practices when creating issues or PR's, since it will save everyone's time.

1. Always try creating regression tests when you find a bug (if possible).
2. Share some context on what you are trying to do, with enough code to reproduce the issue.
3. For general questions, please create a forum thread.
4. When creating a PR for a feature, make sure to create a parallel PR for docs too.


## Regression Tests

Regression tests are tests, which shows how a piece of code fails under certain circumstance, but the beauty is even after the failure, the test suite will never fail. Actually is a nice way to notify about bugs, but making sure everything is green.

The regression tests are created using

```
test.failing('2 + 2 is always 4, but add method returns 6', (assert) => {
assert.true(add(2, 2), 4)
})
```

Example configuration file can be downloaded from [examples/mail.js](examples/mail.js), and should be kept inside `config/mail.js`.
Now since the `add` method has a bug, it will return `6` instead of `4`. But the build will pass.

[appveyor-image]: https://img.shields.io/appveyor/ci/thetutlage/adonis-mail/master.svg?style=flat-square

[appveyor-url]: https://ci.appveyor.com/project/thetutlage/adonis-mail

[Official Documentation](http://adonisjs.com/docs/mail)
[npm-image]: https://img.shields.io/npm/v/@adonisjs/mail.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@adonisjs/mail

## <a name="contribution-guidelines"></a>Contribution Guidelines
[travis-image]: https://img.shields.io/travis/adonisjs/adonis-mail/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/adonisjs/adonis-mail

In favor of active development we accept contributions for everyone. You can contribute by submitting a bug, creating pull requests or even improving documentation.
[coveralls-image]: https://img.shields.io/coveralls/adonisjs/adonis-mail/develop.svg?style=flat-square

You can find a complete guide to be followed strictly before submitting your pull requests in the [Official Documentation](http://adonisjs.com/docs/2.0/contributing).
[coveralls-url]: https://coveralls.io/github/adonisjs/adonis-mail
22 changes: 22 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
environment:
matrix:
- nodejs_version: 'Stable'
- nodejs_version: '7'

init:
git config --global core.autocrlf true

install:
- ps: Install-Product node $env:nodejs_version
- npm install

test_script:
- node --version
- npm --version
- npm run test:win

build: off
clone_depth: 1

matrix:
fast_finish: true
40 changes: 40 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use strict'

/*
* adonis-framework
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

const semver = require('semver')
const { spawn } = require('child_process')
const spawnArgs = []

if (semver.lt(process.version, '8.0.0')) {
spawnArgs.push('--harmony-async-await')
}

function local () {
spawnArgs.push('./node_modules/.bin/japa')
const tests = spawn('node', spawnArgs)
tests.stdout.on('data', (data) => process.stdout.write(data))
tests.stderr.on('data', (data) => process.stderr.write(data))
tests.on('close', (code) => process.exit(code))
}

function win () {
spawnArgs.push('./node_modules/japa-cli/index.js')
const tests = spawn('node', spawnArgs)
tests.stdout.on('data', (data) => process.stdout.write(data))
tests.stderr.on('data', (data) => process.stderr.write(data))
tests.on('close', (code) => process.exit(code))
}

if (process.argv.indexOf('--local') > -1) {
local()
} else if (process.argv.indexOf('--win') > -1) {
win()
}
61 changes: 61 additions & 0 deletions examples/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
'use strict'

const Env = use('Env')

module.exports = {
/*
|--------------------------------------------------------------------------
| Connection
|--------------------------------------------------------------------------
|
| Connection to be used for sending emails. Each connection needs to
| define a driver too.
|
*/
connection: Env.get('MAIL_CONNECTION', 'smtp'),

/*
|--------------------------------------------------------------------------
| SMTP
|--------------------------------------------------------------------------
|
| Here we define configuration for sending emails via SMTP.
|
*/
smtp: {
driver: 'smtp',
pool: true,
port: 2525,
host: '',
secure: false,
auth: {
user: Env.get('MAIL_USERNAME'),
pass: Env.get('MAIL_PASSWORD')
},
maxConnections: 5,
maxMessages: 100,
rateLimit: 10
},

/*
|--------------------------------------------------------------------------
| SparkPost
|--------------------------------------------------------------------------
|
| Here we define configuration for spark post. Extra options can be defined
| inside the `extra` object.
|
| https://developer.sparkpost.com/api/transmissions.html#header-options-attributes
|
| extras: {
| campaign_id: 'sparkpost campaign id',
| options: { // sparkpost options }
| }
|
*/
sparkpost: {
driver: 'sparkpost',
apiKey: Env.get('SPARKPOST_API_KEY'),
extras: {}
}
}

0 comments on commit 3aa77c3

Please sign in to comment.