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.
26 lines
407 B
26 lines
407 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(url + `?to=${to}&subject=${subject}&body=${body}&from=${from}`, (err, res, body) => {
|
||
|
resolve(body);
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
return o;
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports = mail;
|
||
|
|