forked from collinbrewer/parse-server-amazon-ses-adapter
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (27 loc) · 709 Bytes
/
index.js
File metadata and controls
33 lines (27 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var AmazonSES = require("node-ses");
module.exports = function (options) {
var sesClient = AmazonSES.createClient({
key: options.accessKeyId,
secret: options.secretAccessKey,
amazon: options.awsEndpoint,
});
var sendMail = function (mail) {
return new Promise(function (resolve, reject) {
sesClient.sendEmail({
to: [mail.to],
from: options.from,
subject: mail.subject,
message: mail.text
}, function (err, data) {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
};
return {
sendMail: sendMail
}
};