Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added STS (Security Token Service) support for AWS SES requests. #143

Merged
merged 1 commit into from

2 participants

Jimb Esser Andris Reinman
Jimb Esser

Also fixed AWS requests not working through command line interface.

Jimb Esser Jimbly Added STS support for AWS SES requests.
Fixed AWS requests not working through command line interface.
588e005
Andris Reinman andris9 merged commit 3aa42b1 into from
Andris Reinman
Owner

Pushed to npm as v0.3.44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 6, 2013
  1. Jimb Esser

    Added STS support for AWS SES requests.

    Jimbly authored
    Fixed AWS requests not working through command line interface.
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 7 deletions.
  1. +6 −5 bin/nodemailer
  2. +8 −2 lib/engines/ses.js
11 bin/nodemailer 100755 → 100644
View
@@ -24,6 +24,7 @@ if(argv.help){
console.log("Amazon SES options");
console.log(" --key=[AWSKey] Amazon SES key");
console.log(" --secret=[AWSSecret] Amazon SES secret");
+ console.log(" --token=[STS Token] Amazon SES security token if using STS");
console.log("");
console.log("Mail options");
console.log(" --from=[address] Sender of the mail");
@@ -59,7 +60,8 @@ var transportType = (argv.transport || configFile.transport || process.env.NODE
port = argv.port || configFile.port || process.env.NODEMAILER_PORT,
secure = (argv.secure || configFile.secure || process.env.NODEMAILER_SECURE || "").toString().toLowerCase().trim(),
key = argv.key || argv.k || configFile.key || process.env.NODEMAILER_KEY,
- secret = argv.secret || configFile.secret || process.env.NODEMAILER_SECRET;
+ secret = argv.secret || configFile.secret || process.env.NODEMAILER_SECRET
+ token = argv.token || configFile.token || process.env.NODEMAILER_TOKEN;
if(!transportType){
transportType = host?"smtp": (key?"ses":"sendmail");
@@ -86,10 +88,9 @@ switch(transportType.toUpperCase().trim()){
}
break;
case "SES":
- transportOptions.auth = {
- AWSAccessKeyID: key,
- AWSSecretKey: secret
- }
+ transportOptions.AWSAccessKeyID = key;
+ transportOptions.AWSSecretKey = secret;
+ transportOptions.AWSSecurityToken = token;
}
var transport = nodemailer.createTransport(transportType, transportOptions);
10 lib/engines/ses.js
View
@@ -71,12 +71,18 @@ SESTransport.prototype.handleMessage = function(email, callback) {
urlparts = urllib.parse(this.options.ServiceUrl),
- params = this.buildKeyValPairs({
+ pairs = {
'Action': 'SendRawEmail',
'RawMessage.Data': (new Buffer(email, "utf-8")).toString('base64'),
'Version': '2010-12-01',
'Timestamp': this.ISODateString(date)
- }),
+ };
+
+ if (this.options.AWSSecurityToken) {
+ pairs['SecurityToken'] = this.options.AWSSecurityToken;
+ }
+
+ var params = this.buildKeyValPairs(pairs),
reqObj = {
host: urlparts.hostname,
Something went wrong with that request. Please try again.