Skip to content

Instantly share code, notes, and snippets.

@amosuro
Created November 5, 2018 12:28
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 amosuro/889b651088e79436a5e467c787c2c823 to your computer and use it in GitHub Desktop.
Save amosuro/889b651088e79436a5e467c787c2c823 to your computer and use it in GitHub Desktop.
module.exports.sendMail = (sender, receivers, data) => {
const params = {
Destination: {
ToAddresses: receivers
},
Message: {
Subject: {
Charset: 'UTF-8',
Data: 'Website Enquiry'
},
Body: {
Html: {
Charset: "UTF-8",
Data: htmlTemplate(data)
}
}
},
Source: sender,
};
const sendPromise = new AWS.SES().sendEmail(params).promise();
return sendPromise
.then((data) => data)
.catch((err) => {
throw new Error(err);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment