Created
November 5, 2018 12:28
-
-
Save amosuro/889b651088e79436a5e467c787c2c823 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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