lab06-3u188whj3 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/m06.js +29 -0
- package/package.json +14 -0
package/m06.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const nodemailer = require("nodemailer");
|
|
2
|
+
|
|
3
|
+
module.exports = function ({ email, password, to }) {
|
|
4
|
+
if (!email || !password || !to) {
|
|
5
|
+
throw new Error("Не заданы параметры email, password или to");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const transporter = nodemailer.createTransport({
|
|
9
|
+
service: "gmail",
|
|
10
|
+
auth: {
|
|
11
|
+
user: email,
|
|
12
|
+
pass: password,
|
|
13
|
+
},
|
|
14
|
+
debug: true,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
send: async function (message) {
|
|
19
|
+
const mailOptions = {
|
|
20
|
+
from: email,
|
|
21
|
+
to: to,
|
|
22
|
+
subject: "msg",
|
|
23
|
+
html: message,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return transporter.sendMail(mailOptions);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": {
|
|
3
|
+
"nodemailer": "7.0.9"
|
|
4
|
+
},
|
|
5
|
+
"name": "lab06-3u188whj3",
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"main": "m06.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"author": "pashketlalka",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"description": ""
|
|
14
|
+
}
|