mirror of https://github.com/IoTcat/ushio-mail.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.
34 lines
475 B
34 lines
475 B
|
|
|
|
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; |
|
|
|
|