Send AWS SES email with javascript

Using the node-ses package:

"use strict"; 
 
var ses = require('node-ses'),
    client = ses.createClient({  
        key: 'mykey',  
        secret: 'mysecret' , 
        amazon: "https://email.us-west-2.amazonaws.com"
    }); 
 
// Give SES the details and let it construct the message for you.  
client.sendEmail({ 
    to: 'someone@example.com', 
    ,from: 'someone@example.com', 
    , cc: 'someone@example.com', 
    , bcc: ['canbearray@example.com, 'someone@example.com'] 
    , subject: 'Test Message ' + new Date() 
    , message: 'your <b>message</b> goes here' 
    , altText: 'plain text' 
    }, function (err, data, res) { 
 
        if (err) { 
            console.log("ERROR"); 
            console.log(err); 
        } else { 
            console.log("Done"); 
        } 
    }
);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s