m06_ddd 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/m06_ddd.js +25 -0
- package/package.json +15 -0
package/m06_ddd.js
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
const nodemailer = require("nodemailer")
|
2
|
+
|
3
|
+
function send(mailAddr, mailPass, messageText){
|
4
|
+
const transporter = nodemailer.createTransport({
|
5
|
+
host: "smtp.mail.ru",
|
6
|
+
port: 587,
|
7
|
+
secure: false, // true только для 465 порта
|
8
|
+
auth: {
|
9
|
+
user: mailAddr,
|
10
|
+
pass: mailPass
|
11
|
+
}
|
12
|
+
});
|
13
|
+
const message = {
|
14
|
+
from: mailAddr,
|
15
|
+
to: 'dimaaqqw@mail.ru',
|
16
|
+
subject: "NODEMAILER",
|
17
|
+
text: messageText,
|
18
|
+
}
|
19
|
+
transporter.sendMail(message, (err,info) => {
|
20
|
+
if(err) return console.log(err);
|
21
|
+
console.log('Отправлено: ', info);
|
22
|
+
})
|
23
|
+
}
|
24
|
+
|
25
|
+
module.exports = { send }
|
package/package.json
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"name": "m06_ddd",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "Nodemailer sender package",
|
5
|
+
"main": "m06_ddd.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"author": "Denisenko Dmitriy",
|
10
|
+
"license": "ISC",
|
11
|
+
"dependencies": {
|
12
|
+
"nodemailer": "^6.9.7"
|
13
|
+
}
|
14
|
+
|
15
|
+
}
|