-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
76 lines (67 loc) · 4.11 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
var nodemailer = require('nodemailer');
require('dotenv').config();
var readline = require('readline');
var rl = readline.createInterface(
process.stdin, process.stdout);
const { red, green, blue, yellow, cyan, greenBright, redBright, grey, yellowBright, cyanBright, black, blueBright } = require('chalk');
const presser = String.raw`
▓█████ ███▄ ▄███▓ ▄▄▄ ██▓ ██▓ ██████ ██▓███ ▄▄▄ ███▄ ▄███▓ ███▄ ▄███▓▓█████ ██▀███
▓█ ▀ ▓██▒▀█▀ ██▒▒████▄ ▓██▒▓██▒ ▒██ ▒ ▓██░ ██▒▒████▄ ▓██▒▀█▀ ██▒▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒
▒███ ▓██ ▓██░▒██ ▀█▄ ▒██▒▒██░ ░ ▓██▄ ▓██░ ██▓▒▒██ ▀█▄ ▓██ ▓██░▓██ ▓██░▒███ ▓██ ░▄█ ▒
▒▓█ ▄ ▒██ ▒██ ░██▄▄▄▄██ ░██░▒██░ ▒ ██▒▒██▄█▓▒ ▒░██▄▄▄▄██ ▒██ ▒██ ▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄
░▒████▒▒██▒ ░██▒ ▓█ ▓██▒░██░░██████▒ ▒██████▒▒▒██▒ ░ ░ ▓█ ▓██▒▒██▒ ░██▒▒██▒ ░██▒░▒████▒░██▓ ▒██▒
░░ ▒░ ░░ ▒░ ░ ░ ▒▒ ▓▒█░░▓ ░ ▒░▓ ░ ▒ ▒▓▒ ▒ ░▒▓▒░ ░ ░ ▒▒ ▓▒█░░ ▒░ ░ ░░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░
░ ░ ░░ ░ ░ ▒ ▒▒ ░ ▒ ░░ ░ ▒ ░ ░ ░▒ ░ ░░▒ ░ ▒ ▒▒ ░░ ░ ░░ ░ ░ ░ ░ ░ ░▒ ░ ▒░
░ ░ ░ ░ ▒ ▒ ░ ░ ░ ░ ░ ░ ░░ ░ ▒ ░ ░ ░ ░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
`;
console.log(red(presser));
async function doall() {
let testAccount = await nodemailer.createTestAccount();
let transporter = nodemailer.createTransport({
host: "smtp.ethereal.email",
port: 587,
secure: false, // true for 465, false for other ports
auth: {
user: testAccount.user, // generated ethereal user
pass: testAccount.pass, // generated ethereal password
},
});
rl.question('to who do you want to send the mail?', (age) => {
rl.question('what is the subject?', (age1) => {
rl.question('what is content of the mail?', (age2) => {
var mailOptions = {
from: '"Susy" <[email protected]>',
to: age,
subject: age1,
text: age2
};
rl.question('how many times?', name => {
runFunctionXTimes(sendmail, 0, name)
rl.close();
function sendmail() { transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
}
})
})
})
})
function runFunctionXTimes(callback, interval, repeatTimes) {
let repeated = 0;
const intervalTask = setInterval(doTask, interval)
function doTask() {
if ( repeated < repeatTimes ) {
callback()
repeated += 1
} else {
clearInterval(intervalTask)
}
}
}
}
doall()