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
36 lines (29 loc) · 693 Bytes
/
index.js
File metadata and controls
36 lines (29 loc) · 693 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
34
35
36
var AmazonSES = require("amazon-ses-mailer");
module.exports=function(options){
var ses = new AmazonSES(
options.accessKeyId,
options.secretAccessKey,
options.region
);
var sendMail=function(mail){
return new Promise(function(resolve, reject){
ses.send({
from: options.from,
to: [mail.to],
subject: mail.subject,
body: {
text: mail.text
}
}, function(error, data) {
if (error) {
reject(error);
} else {
resolve(data);
}
});
});
};
return {
sendMail: sendMail
}
};