6lab 1.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of 6lab might be problematic. Click here for more details.

package/06-02.html ADDED
@@ -0,0 +1,68 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Node 04-02</title>
6
+ <style type="text/css">
7
+ * {
8
+ color: #011627;
9
+ background-color: #f5f5f5;
10
+ text-align: center;
11
+ font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
12
+ }
13
+ button {
14
+ background-color:#ffc857;
15
+ border: none;
16
+ color: white;
17
+ padding: 8px 15px;
18
+ text-align: center;
19
+ font-size: 14pt;
20
+ border-radius: 10px;
21
+ }
22
+ #status {
23
+ margin: auto;
24
+ margin-top: 10px;
25
+ padding: 10px;
26
+ width: fit-content;
27
+ border-radius: 10px;
28
+ border: 3px solid #8980f5;
29
+ text-align: center;
30
+ display: none;
31
+ padding: 10px 20px;
32
+ max-width: 600px;
33
+ }
34
+ .row {
35
+ margin-bottom: 20px;
36
+ }
37
+ </style>
38
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
39
+ </head>
40
+ <body>
41
+ <h1>task 06-02</h1>
42
+ <form action="http://localhost:5000/" method="POST">
43
+ <div class="row">
44
+ <label>Sender:</label><br>
45
+ <input type="email" name="sender" required/>
46
+ </div>
47
+ <div class="row">
48
+ <label>Password:</label><br>
49
+ <input type="password" name="password" required/>
50
+ </div>
51
+ <div class="row">
52
+ <label>Receiver</label><br>
53
+ <input type="email" name="receiver" required/>
54
+ </div>
55
+ <div class="row">
56
+ <label>Subject:</label><br>
57
+ <input type="text" name="subject" required/>
58
+ </div>
59
+ <div class="row">
60
+ <label>Your message:</label><br>
61
+ <input type="text" name="message" required/>
62
+ </div>
63
+ <div>
64
+ <button type="submit">Send message</button>
65
+ </div>
66
+ </form>
67
+ </body>
68
+ </html>
package/06-03.js ADDED
@@ -0,0 +1,8 @@
1
+ const http = require('http');
2
+ const send = require('./m0603.js');
3
+
4
+ http.createServer((request, response) => {
5
+ response.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
6
+ send('[06-03] всем привет кто первый день во вконтакте');
7
+ response.end('<h2>Message sucessfully sent.</h2>');
8
+ }).listen(5000, () => console.log('Server running at http://localhost:5000/\n'));
package/06-04.js ADDED
@@ -0,0 +1,8 @@
1
+ const send = require('C:/Users/valda/AppData/Roaming/npm/node_modules/secxmail');
2
+ const http = require('http');
3
+
4
+ http.createServer((req, res) => {
5
+ res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
6
+ send('[06-04] hello from secxmail GLOBAL module!');
7
+ res.end('<h2>Message sucessfully sent.</h2>');
8
+ }).listen(5000, () => console.log('Server running at http://localhost:5000/\n'));
package/app.js ADDED
@@ -0,0 +1,60 @@
1
+ //icqbbmbsahofmuyw
2
+ //pnrykthhiqovrczc
3
+
4
+
5
+ const http = require('http');
6
+ const url = require('url');
7
+ const fs = require('fs');
8
+ const { parse } = require('querystring');
9
+ const nodemailer = require('nodemailer');
10
+
11
+
12
+
13
+ http.createServer((request, response) => {
14
+ response.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
15
+
16
+ if (url.parse(request.url).pathname === '/' && request.method === 'GET')
17
+ {
18
+ response.end(fs.readFileSync('./06-02.html'));
19
+ }
20
+ else if (url.parse(request.url).pathname === '/' && request.method === 'POST')
21
+ {
22
+ let body = '';
23
+ request.on('data', chunk => { body += chunk.toString(); });
24
+
25
+ request.on('end', () => {
26
+ let parm = parse(body);
27
+
28
+ const transporter = nodemailer.createTransport({
29
+ host: 'smtp.gmail.com',
30
+ port: 465,
31
+ secure: false,
32
+ service: 'Gmail',
33
+ auth: {
34
+ user: parm.sender,
35
+ pass: parm.password
36
+ }
37
+ });
38
+
39
+ const mailOptions = {
40
+ from: parm.sender,
41
+ to: parm.receiver,
42
+ subject: parm.subject,
43
+ text: parm.message
44
+ }
45
+
46
+ transporter.sendMail(mailOptions, (err, info) => {
47
+ err ? console.log(err) : console.log('Sent: ' + info.response);
48
+ })
49
+
50
+ response.end(`<h2>Отправитель: ${parm.sender}</br>Получатель: ${parm.receiver}
51
+ </br>Тема: ${parm.subject}</br>Сообщение: ${parm.message}</h2>`);
52
+ })
53
+ }
54
+
55
+ else
56
+ response.end('<html><body><h1>Error! Visit http://localhost:5000/</h1></body></html>');
57
+ }).listen(5000, () => console.log('Server running at http://localhost:5000/\n'));
58
+
59
+
60
+
package/apps.js ADDED
File without changes
package/index.html ADDED
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Document</title>
8
+ </head>
9
+ <body>
10
+ <form>
11
+ <div>
12
+ <label for="sender" >From:</label>
13
+ <input type="email" id="sender" placeholder="Enter email">
14
+ </div>
15
+ <div>
16
+ <label for="receiver">To:</label>
17
+ <input type="email" id="receiver" placeholder="Enter email">
18
+ </div>
19
+ <div>
20
+ <label for="message">Message:</label>
21
+ <textarea id="message"></textarea>
22
+ </div>
23
+ <button onclick="Send()">Send</button>
24
+ </form>
25
+ <script>
26
+ function Send() {
27
+ fetch('http://localhost:5000/', {
28
+ method: 'POST', mode: 'no-cors',
29
+ headers: { 'Content-Type':'application/json',
30
+ 'Accept':'text/html'
31
+ },
32
+ body: JSON.stringify({from: sender.value,
33
+ to: receiver.value,
34
+ message: message.value})
35
+ }).then(response => response.text()).then(pdata => alert(pdata));
36
+ }
37
+ </script>
38
+ </body>
39
+ </html>
package/m0603.js ADDED
@@ -0,0 +1,35 @@
1
+ const nodemailer = require('nodemailer');
2
+
3
+ const sender = 'nodemailertests1@gmail.com';
4
+ const receiver = 'nodemailertests1@gmail.com';
5
+ const password = 'pnrykthhiqovrczc';
6
+
7
+
8
+ const transporter = nodemailer.createTransport({
9
+ host: 'smtp.gmail.com',
10
+ port: 587,
11
+ secure: false,
12
+ service: 'Gmail',
13
+ auth: {
14
+ user: sender,
15
+ pass: password
16
+ }
17
+ });
18
+
19
+
20
+ send = (message) =>
21
+ {
22
+
23
+ const mailOptions = {
24
+ from: sender,
25
+ to: receiver,
26
+ subject: 'Module m0306',
27
+ text: message
28
+ }
29
+
30
+ transporter.sendMail(mailOptions, (err, info) => {
31
+ err ? console.log(err) : console.log('Sent: ' + info.response);
32
+ })
33
+ }
34
+
35
+ module.exports = send;
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "dependencies": {
3
+ "nodemailer": "^6.8.0",
4
+ "sendmail": "^1.6.1"
5
+ },
6
+ "description": "send message выполнил name partyhome75@gmail.com",
7
+ "keyword": "send name in email-message to partyhome75@gmail.com without smtp",
8
+ "main": "m0603.js",
9
+ "maintainers": [
10
+ {
11
+ "name": "partyhome",
12
+ "email": "partyhome75@gmail.com"
13
+ }
14
+ ],
15
+ "name": "6lab",
16
+ "publishConfig": { "access": "public" },
17
+ "version": "1.0.1"
18
+ }