Skip to content

Instantly share code, notes, and snippets.

@indianburger
Created July 8, 2013 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indianburger/5952151 to your computer and use it in GitHub Desktop.
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.
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