m0603-001 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/m0603.js +30 -0
- package/package.json +12 -0
package/m0603.js
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
const nodemailer = require('nodemailer');
|
2
|
+
|
3
|
+
function send(from, password, to, message) {
|
4
|
+
let transporter = nodemailer.createTransport({
|
5
|
+
host: "smtp.mail.ru",
|
6
|
+
port: 465,
|
7
|
+
secure: true,
|
8
|
+
auth: {
|
9
|
+
user: from,
|
10
|
+
pass: password
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
let mailOptions = {
|
15
|
+
from: from,
|
16
|
+
to: to,
|
17
|
+
subject: 'Message from m0603 module',
|
18
|
+
text: message
|
19
|
+
};
|
20
|
+
|
21
|
+
transporter.sendMail(mailOptions, (error, info) => {
|
22
|
+
if (error) {
|
23
|
+
console.log(error);
|
24
|
+
} else {
|
25
|
+
console.log('Message sent: %s', info.messageId);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
}
|
29
|
+
|
30
|
+
module.exports = { send };
|