Skip to content

Instantly share code, notes, and snippets.

@mako34
Created December 17, 2018 01:17
Show Gist options
  • Save mako34/c76d3f50a192420b3c3cadbcbbcf6c82 to your computer and use it in GitHub Desktop.
Save mako34/c76d3f50a192420b3c3cadbcbbcf6c82 to your computer and use it in GitHub Desktop.
const AWS = require("aws-sdk");
//security settings to use after advice from devOps will be CHANGED!!
AWS.config.update({
accessKeyId: 'accessKey###',
secretAccessKey: 'secretAccessKey###',
region: 'us-east-1'
});
const ses = new AWS.SES({ apiVersion: "2010-12-01" });
const params = {
Destination: {
ToAddresses: ["juanman234@gmail.com"] // email receipent
},
ConfigurationSetName: 'config1', //name of configuration
Message: {
Body: {
Html: {
// HTML Format of the email
Charset: "UTF-8",
Data:
`<html>
<body>
<h1>Hola Marek</h1>
<p style='color:red'>Sample description</p>
<p>SS9 TKT</p>
<img src=\"http://people.sc.fsu.edu/~jburkardt/data/png/dragon.png\" alt=\"Mountain View\" />
</body>
</html>`
},
Text: {
Charset: "UTF-8",
Data: "hola mako!, tkt"
}
},
Subject: {
Charset: "UTF-8",
Data: "Test email"
}
},
Source: "manuel@adawatch.io" //support user's email
};
const sendEmail = ses.sendEmail(params).promise();
sendEmail
.then(data => {
console.log("email submitted to SES", data);
})
.catch(error => {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment