Created
July 8, 2013 20:19
-
-
Save indianburger/5952151 to your computer and use it in GitHub Desktop.
Amazon SES: Sample code to send a really simple email using AWS SDK for node.js using SES service. Haven't tested this exact code, but used this in something that works.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require('aws-sdk'), | |
sesEmailParams, | |
ses; | |
AWS.config.loadFromPath('./config.json'); //http://aws.amazon.com/sdkfornodejs/ | |
ses = new AWS.SES(); | |
sesEmailParams = { | |
Source: "amazon-verified@email.com", //verify sender email in aws console. More info here http://aws.amazon.com/ses/ | |
Destination:{ | |
ToAddresses: ["blah@test.com"] | |
}, | |
Message: { | |
Subject: { | |
Data: "some test subjet" | |
}, | |
Body: { | |
Text: { | |
Data: "test body" | |
} | |
} | |
} | |
}; | |
ses.sendEmail(sesEmailParams, function(err, data){ | |
if (err) { | |
return console.error("error: ", err); | |
} | |
console.log("Email sent: ", data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment