m06_apv 1.0.0 → 1.1.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/package.json +28 -20
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/lab5.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/mo6_APV/package.json +0 -28
- package/zd2.html +0 -34
- package/zd2.js +0 -131
- package/zd3.js +0 -28
- /package/{mo6_APV/m06_APV.js → index.js} +0 -0
package/package.json
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "m06_apv",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "the package for nodemailer",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "Polinavs",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"nodemailer": "^6.9.5"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "https://github.com/Poliinavs"
|
|
19
|
-
}
|
|
20
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "m06_apv",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "the package for nodemailer",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "Polinavs",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"nodemailer": "^6.9.5"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/Poliinavs"
|
|
19
|
+
},
|
|
20
|
+
"node_modules/nodemailer": {
|
|
21
|
+
"version": "6.9.5",
|
|
22
|
+
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.5.tgz",
|
|
23
|
+
"integrity": "sha512-/dmdWo62XjumuLc5+AYQZeiRj+PRR8y8qKtFCOyuOl1k/hckZd8durUUHs/ucKx6/8kN+wFxqKJlQ/LK/qR5FA==",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=6.0.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/.idea/lab5.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/modules.xml
DELETED
package/.idea/vcs.xml
DELETED
package/mo6_APV/package.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "m06_apv",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "the package for nodemailer",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "Polinavs",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"nodemailer": "^6.9.5"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "https://github.com/Poliinavs"
|
|
19
|
-
},
|
|
20
|
-
"node_modules/nodemailer": {
|
|
21
|
-
"version": "6.9.5",
|
|
22
|
-
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.5.tgz",
|
|
23
|
-
"integrity": "sha512-/dmdWo62XjumuLc5+AYQZeiRj+PRR8y8qKtFCOyuOl1k/hckZd8durUUHs/ucKx6/8kN+wFxqKJlQ/LK/qR5FA==",
|
|
24
|
-
"engines": {
|
|
25
|
-
"node": ">=6.0.0"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
package/zd2.html
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Отправить почту с помощью Nodemailer</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<h1>Отправить почту с помощью Nodemailer</h1>
|
|
9
|
-
<form action="/send" method="post">
|
|
10
|
-
<label id="fromEmail">Отправитель:</label>
|
|
11
|
-
<input type="email" id="sender" name="sender" required><br>
|
|
12
|
-
<label id="toEmail">Получатель:</label>
|
|
13
|
-
<input type="email" id="receiver" name="receiver" required><br>
|
|
14
|
-
<label id="message1">Сообщение:</label><br>
|
|
15
|
-
<textarea name="message" id="message" rows="4" cols="50" required></textarea><br>
|
|
16
|
-
<input type="submit" onclick="Post()" value="Отправить">
|
|
17
|
-
</form>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
function Post(){
|
|
23
|
-
console.log('POST');
|
|
24
|
-
fetch('http://localhost:5000/', {
|
|
25
|
-
method: 'POST', mode: "no-cors",
|
|
26
|
-
headers: {
|
|
27
|
-
'Content-Type': 'application/json',
|
|
28
|
-
'Accept': 'text/html'
|
|
29
|
-
},
|
|
30
|
-
body: JSON.stringify({sender: sender.value, receiver: receiver.value, message: message.value})
|
|
31
|
-
}).then(response => response.text())
|
|
32
|
-
.then(pdata => alert(pdata));
|
|
33
|
-
}
|
|
34
|
-
</script>
|
package/zd2.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const http = require('http');
|
|
7
|
-
const nodemailer = require('nodemailer');
|
|
8
|
-
const querystring = require('querystring');
|
|
9
|
-
|
|
10
|
-
const port = 3000;
|
|
11
|
-
//pol.avs@outlook.com
|
|
12
|
-
const server = http.createServer((req, res) => {
|
|
13
|
-
if (req.method === 'GET' && req.url === '/') {
|
|
14
|
-
// Отправить HTML-форму для ввода данных
|
|
15
|
-
fs.readFile('zd2.html', 'utf8', (err, data) => {
|
|
16
|
-
if (err) {
|
|
17
|
-
console.error('Ошибка при чтении файла index.html:', err);
|
|
18
|
-
res.writeHead(500, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
19
|
-
res.end('Ошибка при чтении файла');
|
|
20
|
-
} else {
|
|
21
|
-
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
22
|
-
res.end(data);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
} else if (req.method === 'POST' && req.url === '/send') {
|
|
27
|
-
console.log("POST");
|
|
28
|
-
let requestBody = '';
|
|
29
|
-
|
|
30
|
-
req.on('data', (data) => {
|
|
31
|
-
requestBody += data.toString();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
req.on('end', async () => {
|
|
35
|
-
const {sender, receiver, message} = querystring.parse(requestBody);
|
|
36
|
-
console.log(message);
|
|
37
|
-
console.log(receiver);
|
|
38
|
-
console.log(sender);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const password = 'teddy.174'; // Ваш пароль
|
|
42
|
-
|
|
43
|
-
const transporter = nodemailer.createTransport({
|
|
44
|
-
host: 'smtp.office365.com', // Сервер SMTP Outlook
|
|
45
|
-
port: 587, // Порт SMTP
|
|
46
|
-
secure: false, // Указываем, что соединение не является безопасным (STARTTLS)
|
|
47
|
-
auth: {
|
|
48
|
-
user: sender,
|
|
49
|
-
pass: password,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const mailOptions = {
|
|
54
|
-
from: sender,
|
|
55
|
-
to: receiver, // Адрес получателя
|
|
56
|
-
subject: 'LAB', // Тема письма
|
|
57
|
-
text: message, // Текст сообщения
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
transporter.sendMail(mailOptions, (err, info) => {
|
|
61
|
-
if (err) {
|
|
62
|
-
console.error(err);
|
|
63
|
-
} else {
|
|
64
|
-
console.log('Отправлено: ' + info.response);
|
|
65
|
-
res.writeHead(400, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
66
|
-
res.end('Отправлено');
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// Настройки транспорта для Nodemailer (замените на свои данные)
|
|
83
|
-
/* const transporter = nodemailer.createTransport({
|
|
84
|
-
host: 'smtp.ethereal.email',
|
|
85
|
-
port: 587,
|
|
86
|
-
secure: false,
|
|
87
|
-
auth: {
|
|
88
|
-
user: sender, // Замените на свой Gmail адрес
|
|
89
|
-
pass: "Pol_Kap6607860!" // Замените на пароль от вашего Gmail аккаунта
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
/!* const mailOptions = {
|
|
94
|
-
from: sender,
|
|
95
|
-
to: receiver,
|
|
96
|
-
subject: 'Тестовое письмо с использованием Nodemailer',
|
|
97
|
-
text: message
|
|
98
|
-
};*!/
|
|
99
|
-
let result = await transporter.sendMail({
|
|
100
|
-
from: sender,
|
|
101
|
-
to: receiver,
|
|
102
|
-
subject: 'Message from Node js',
|
|
103
|
-
text: message,
|
|
104
|
-
html:
|
|
105
|
-
'This <i>message</i> was sent from <strong>Node.js</strong> server.',
|
|
106
|
-
});
|
|
107
|
-
console.log(result)*/
|
|
108
|
-
|
|
109
|
-
// Отправка письма
|
|
110
|
-
/* transporter.sendMail(mailOptions, (error, info) => {
|
|
111
|
-
if (error) {
|
|
112
|
-
console.log('Ошибка при отправке: ' + error);
|
|
113
|
-
res.writeHead(500, { 'Content-Type': 'text/plain' });
|
|
114
|
-
res.end('Ошибка при отправке письма');
|
|
115
|
-
} else {
|
|
116
|
-
console.log('Письмо отправлено: ' + info.response);
|
|
117
|
-
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
118
|
-
res.end('Письмо успешно отправлено');
|
|
119
|
-
}
|
|
120
|
-
});*/
|
|
121
|
-
});
|
|
122
|
-
} else {
|
|
123
|
-
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
124
|
-
res.end('Страница не найдена');
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
server.listen(port, () => {
|
|
129
|
-
console.log(`Сервер запущен на порту ${port}`);
|
|
130
|
-
});
|
|
131
|
-
console.log("http://localhost:3000/")
|
package/zd3.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const send = require("./mo6_APV/m06_APV.js");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const http = require('http');
|
|
7
|
-
const nodemailer = require('nodemailer');
|
|
8
|
-
const querystring = require('querystring');
|
|
9
|
-
|
|
10
|
-
const port = 3000;
|
|
11
|
-
//pol.avs@outlook.com
|
|
12
|
-
const server = http.createServer((req, res) => {
|
|
13
|
-
if (req.method === 'GET' && req.url === '/') {
|
|
14
|
-
// Отправить HTML-форму для ввода данных
|
|
15
|
-
send('teddy.174',"pol.avs@outlook.com","Message from 3");
|
|
16
|
-
res.writeHead(500, { 'Content-Type': 'text/plain' });
|
|
17
|
-
res.end('All Good ');
|
|
18
|
-
|
|
19
|
-
} else {
|
|
20
|
-
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
|
21
|
-
res.end('Страница не найдена');
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
server.listen(port, () => {
|
|
26
|
-
console.log(`Сервер запущен на порту ${port}`);
|
|
27
|
-
});
|
|
28
|
-
console.log("http://localhost:3000/")
|
|
File without changes
|