1.0.0 • Published 8 years ago
mbu-ses v1.0.0
mbu-ses
Amazon SES convenience module.
Configuration
Create a configuration json file:
{
"transportParams": {
"host": "email-smtp.us-east-1.amazonaws.com",
"port": "25",
"auth": {
"user": "USER_ID",
"pass": "PASSWORD"
}
}
}
Usage
1) Add a require statement to your application:
var MBU = require('mbu-ses');
2) Instantiate a new SES object from the AWS module passing in the config json file path.
var mbuSes = new MBU(__dirname + "/config.json");
3) Create a callback function with and err and response parameter. This is used as the callback function for the SES objects send functions:
function (err, message)
{
if (err)
console.log(err.message);
else
// DO SOMETHING...
}
4) Send a text email by calling ses.sendTextEmail():
mbuSes.sendTextEmail(<To Email Address Strings>, <From Email Address String>, <Subject String>, <Body String>, function (error, message) {
// DO SOMETHING
});
5) Send an HTML email by calling ses.sendTextEmail():
mbuSes.sendTextEmail(<To Email Address Strings>, <From Email Address String>, <Subject String>, <Body HTML as String>, function (error, message) {
// DO SOMETHING
});