mirror of https://github.com/IoTcat/coron-lstn.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
509 B
35 lines
509 B
4 years ago
|
|
||
|
|
||
|
var mail = (url) => {
|
||
|
|
||
|
var o = {
|
||
|
send: (to, subject, body, from) => send(to, subject, body, from)
|
||
|
};
|
||
|
|
||
|
|
||
|
const request = require('request');
|
||
|
|
||
|
var send = (to, subject, body, from) => {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
request.post({
|
||
|
"url": url,
|
||
|
formData: {
|
||
|
"to": to,
|
||
|
"subject": subject,
|
||
|
"body": body,
|
||
|
"from": from
|
||
|
}
|
||
|
},
|
||
|
(err, res, body) => {
|
||
|
resolve(body);
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
return o;
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports = mail;
|
||
|
|