Skip to content

Instantly share code, notes, and snippets.

@sallar
Created June 27, 2017 10:46
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 sallar/308ba3dcc1116dd94bf01fcdbf82a0e9 to your computer and use it in GitHub Desktop.
Save sallar/308ba3dcc1116dd94bf01fcdbf82a0e9 to your computer and use it in GitHub Desktop.
SES Example
const nodemailer = require('nodemailer');
const aws = require('aws-sdk');
// create Nodemailer SES transporter
const transporter = nodemailer.createTransport({
SES: new aws.SES({
apiVersion: '2010-12-01',
region: 'eu-west-1'
})
});
// send some mail
transporter.sendMail({
from: 'sallar@kaboli.org',
to: 'salar.kaboli@tieto.com',
subject: 'Message',
text: 'I hope this message gets sent!',
}, (err, info) => {
if (err) {
console.log(err);
return;
}
console.log(info.envelope);
console.log(info.messageId);
});
{
"name": "aws",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"aws-sdk": "^2.77.0",
"nodemailer": "^4.0.1",
"nodemailer-ses-transport": "^1.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment