New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodemailer-ses-transport

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodemailer-ses-transport - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

4

CHANGELOG.md
# Changelog
## v1.3.1 2016-05-13
* Added error handler for broken message generator
## v1.3.0 2016-02-18

@@ -8,0 +4,0 @@

47

lib/ses-transport.js

@@ -11,4 +11,2 @@ 'use strict';

var THROTTLE_DELAY = 5;
/**

@@ -53,4 +51,4 @@ * <p>Generates a Transport object for Amazon SES with aws-sdk</p>

this.sending = false;
this.currentConnections = 0;
this.maxConnections = Number(options.maxConnections) || Infinity;
this.startTime = 0;
this.count = 0;

@@ -77,6 +75,4 @@ this.name = 'SES';

this.processQueue();
} else if (this.currentConnections < this.maxConnections) {
} else {
this.sendMessage(mail, callback);
} else {
setTimeout(this.send.bind(this, mail, callback), THROTTLE_DELAY);
}

@@ -90,2 +86,15 @@ };

if (this.sending) {
var timeDelta = Date.now() - this.startTime;
if (timeDelta >= 1000 / this.rateLimit) {
this.count = 0;
this.sending = false;
setImmediate(this.processQueue.bind(this));
} else {
this.count++;
setTimeout(function () {
this.sending = false;
this.processQueue();
}.bind(this), Math.ceil(1000 / this.rateLimit * this.count - timeDelta));
}
return;

@@ -99,2 +108,3 @@ }

this.sending = true;
this.startTime = Date.now();
var item = this.queue.shift();

@@ -111,11 +121,2 @@

}.bind(this));
setTimeout(function sendNextMail() {
if (this.currentConnections < this.maxConnections) {
this.sending = false;
this.processQueue();
} else {
setTimeout(sendNextMail.bind(this), THROTTLE_DELAY);
}
}.bind(this), Math.ceil(1000 / this.rateLimit));
};

@@ -151,11 +152,3 @@

};
if (this.options.source) {
params.Source = this.options.source;
}
if (mail.data.Destinations) {
params.Destinations = mail.data.Destinations;
}
this.currentConnections++;
this.ses.sendRawEmail(params, function (err, data) {
this.currentConnections--;
this.responseHandler(err, mail, data, callback);

@@ -182,3 +175,3 @@ }.bind(this));

envelope: mail.data.envelope || mail.message.getEnvelope(),
messageId: data && data.MessageId && data.MessageId + '@' + this.options.region + '.amazonses.com'
messageId: data && data.MessageId && data.MessageId + '@email.amazonses.com'
});

@@ -205,6 +198,2 @@ };

mailStream.on('error', function(err) {
callback(err);
});
mailStream.on('end', function () {

@@ -211,0 +200,0 @@ callback(null, Buffer.concat(chunks, chunklen).toString());

{
"name": "nodemailer-ses-transport",
"version": "1.5.0",
"version": "1.5.1",
"description": "SES transport for Nodemailer",

@@ -24,13 +24,12 @@ "main": "lib/ses-transport.js",

"dependencies": {
"aws-sdk": "^2.6.12"
"aws-sdk": "^2.2.36"
},
"devDependencies": {
"chai": "~3.5.0",
"grunt": "~1.0.1",
"grunt-cli": "^1.2.0",
"grunt-eslint": "~19.0.0",
"grunt-mocha-test": "~0.13.2",
"mocha": "^3.1.2",
"sinon": "^1.17.6"
"grunt": "~0.4.5",
"grunt-eslint": "~18.0.0",
"grunt-mocha-test": "~0.12.7",
"mocha": "^2.4.5",
"sinon": "^1.17.3"
}
}

@@ -1,64 +0,7 @@

# SES transport module for Nodemailer
# nodemailer-ses-transport
Applies for [Nodemailer](http://www.nodemailer.com/) v1+ and not for v0.x where transports are built-in.
![Nodemailer](https://raw.githubusercontent.com/nodemailer/nodemailer/master/assets/nm_logo_200x136.png)
## Warning about AWS tokens
AWS SES module for Nodemailer.
It has been reported that keys that have special symbols in it (ie. slash /) probably do not work and return signature errors. To overcome this, try to generate keys with only letters and numbers.
## Usage
Install with npm
npm install nodemailer-ses-transport
Require to your script
```javascript
var nodemailer = require('nodemailer');
var sesTransport = require('nodemailer-ses-transport');
```
Create a Nodemailer transport object
```javascript
var transporter = nodemailer.createTransport(sesTransport(options))
```
Where
* **options** defines connection data
* **ses** - instantiated AWS SES object. If not provided then one is generated automatically using the other options
* **accessKeyId** - *optional* AWS access key. Not used if `options.ses` is set.
* **secretAccessKey** - *optional* AWS secret. Not used if `options.ses` is set.
* **sessionToken** - *optional* session token. Not used if `options.ses` is set.
* **region** - *optional* Specify the region to send the service request to. Defaults to *us-east-1*. Not used if `options.ses` is set.
* **httpOptions** - A set of options to pass to the low-level AWS HTTP request. See options in the [AWS-SES docs](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SES.html). Not used if `options.ses` is set.
* **rateLimit** - *optional* Specify the amount of messages that [can be sent in 1 second](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/limits.html). For example if you want to send at most 5 messages in a second, set this value to 5. If you do not set it, rate limiting is not applied and messages are sent out immediately.
* **maxConnections** - *optional* Specify the maximum number of messages to be "in-flight" at any one point in time. Useful for preventing suffocation of an internet connection when sending lots of messages.
* **Destinations** - *optional* Specify envelope info
### Examples
**Example 1.** Use AWS credentials to set up the sender
```javascript
var transport = nodemailer.createTransport(sesTransport({
accessKeyId: "AWSACCESSKEY",
secretAccessKey: "AWS/Secret/key",
rateLimit: 5 // do not send more than 5 messages in a second
}));
```
**Example 2.** Use already existing AWS SES object instance
```javascript
var ses = new AWS.SES({accessKeyId:....});
var transport = nodemailer.createTransport(sesTransport({
ses: ses
}));
```
## License
**MIT**
See [Nodemailer homepage](https://nodemailer.com/transports/ses/) for documentation and terms of using SES.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc