Skip to content

Commit 69caa8e

Browse files
committed
Removed dotenv, updated README, and general cleanup. Closes #3
1 parent 701af9e commit 69caa8e

File tree

4 files changed

+54
-45
lines changed

4 files changed

+54
-45
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
language: node_js
22
node_js:
3+
- '4.1'
4+
- '4.0'
5+
- '0.12'
36
- '0.10'

README.md

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,57 @@ SparkPost transport for Nodemailer
55
[![Build Status](https://travis-ci.org/SparkPost/nodemailer-sparkpost-transport.svg?branch=master)](https://travis-ci.org/Sparkpost/nodemailer-sparkpost-transport)
66
[![NPM version](https://badge.fury.io/js/nodemailer-sparkpost-transport.png)](http://badge.fury.io/js/nodemailer-sparkpost-transport) [![Slack Status](http://slack.sparkpost.com/badge.svg)](http://slack.sparkpost.com)
77

8-
## Installation
8+
## Usage
9+
10+
Install with npm
911

1012
```
1113
npm install nodemailer-sparkpost-transport
1214
```
1315

16+
Require to your script
17+
18+
```javascript
19+
var nodemailer = require('nodemailer');
20+
var sparkPostTransport = require('nodemailer-sparkpost-transport');
21+
```
22+
23+
Create a Nodemailer transport object
24+
25+
```javascript
26+
var transporter = nodemailer.createTransport(sparkPostTransport(options))
27+
```
28+
29+
Where
30+
31+
- **options** defines connection and message data
32+
- `sparkPostApiKey` - SparkPost [API Key](https://app.sparkpost.com/account/credentials). If not provided, it will use the `SPARKPOST_API_KEY` env var.
33+
- `campaign_id` - Name of the campaign
34+
- `content` - Content that will be used to construct a message
35+
- `metadata` - Transmission level metadata containing key/value pairs
36+
- `options` - JSON object in which transmission options are defined
37+
- `substitution_data` - Key/value pairs that are provided to the substitution engine
38+
39+
For more information, see the [SparkPost API Documentation for Transmissions](https://developers.sparkpost.com/api/#/reference/transmissions)
40+
41+
42+
43+
Send a message
44+
45+
```javascript
46+
transport.sendMail(options, function(err, info) {});
47+
```
48+
49+
Where
50+
51+
- **options** defines connection and message data
52+
- `recipients` - Inline recipient objects or object containing stored recipient list ID. See [SparkPost API Documentation for Recipient Lists](https://developers.sparkpost.com/api/#/reference/recipient-lists) for more information.
53+
- `campaign_id` - Override for option above
54+
- `content` - Override for option above
55+
- `metadata` - Override for option above
56+
- `options` - Override for option above
57+
- `substitution_data` - Override for option above
58+
1459
## Example
1560

1661
```javascript
@@ -19,8 +64,8 @@ npm install nodemailer-sparkpost-transport
1964
var nodemailer = require('nodemailer');
2065
var sparkPostTransport = require('nodemailer-sparkpost-transport');
2166

22-
// Will use dotenv to load .env variables, passing in options to send with SparkPost
2367
var transporter = nodemailer.createTransport(sparkPostTransport({
68+
"sparkPostApiKey": "<YOUR_API_KEY>",
2469
"options": {
2570
"open_tracking": true,
2671
"click_tracking": true,
@@ -60,37 +105,3 @@ transporter.sendMail({
60105
}
61106
});
62107
```
63-
64-
## Documentation
65-
66-
### `sparkPostTransport`
67-
68-
```javascript
69-
sparkPostTransport(options);
70-
```
71-
72-
#### Available options
73-
74-
+ `campaign_id`
75-
+ `content`
76-
+ `metadata`
77-
+ `options`
78-
+ `sparkPostApiKey`
79-
+ `substitution_data`
80-
+ `tags`
81-
82-
### `sendMail`
83-
84-
```javascript
85-
transport.sendMail(options, function(err, info) {});
86-
```
87-
88-
#### Available options
89-
90-
+ `campaign_id`
91-
+ `content`
92-
+ `metadata`
93-
+ `options`
94-
+ `recipients`
95-
+ `substitution_data`
96-
+ `tags`

lib/sparkPostTransport.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
'use strict';
22

3-
// Load environment configurations
4-
require('dotenv').load();
5-
63
// Dependencies
74
var pkg = require('../package');
85
var SparkPost = require('sparkpost');

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@
2222
},
2323
"homepage": "https://github.com/SparkPost/nodemailer-sparkpost-transport",
2424
"dependencies": {
25-
"dotenv": "^1.2.0",
26-
"email-addresses": "^2.0.1",
27-
"sparkpost": "^1.1.0"
25+
"sparkpost": "^1.3.5"
2826
},
2927
"devDependencies": {
30-
"chai": "^2.2.0",
31-
"mocha": "^2.2.1",
32-
"sinon": "^1.14.1",
28+
"chai": "^3.5.0",
29+
"mocha": "^2.4.5",
30+
"sinon": "^1.17.4",
3331
"with-package": "^0.2.0"
3432
}
3533
}

0 commit comments

Comments
 (0)