-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.js
31 lines (27 loc) · 1.39 KB
/
client.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
const chalk = require('chalk');
const Guerrilla = require('guerrillamail-api');
console.log(chalk.magentaBright('Starting Guerrilla Mail CLI...'));
const client = new Guerrilla({
pollInterval: 20000
});
client.on('emailAddress', (details) => {
client.pollStart();
console.log(chalk`{magentaBright Email address assigned!\nYour temporary email address is:} {gray ${details.email_addr}}`);
console.log(chalk`{magentaBright Your emailaddress alias is:} {gray ${details.alias}@guerrillamailblock.com}`);
console.log(chalk.magentaBright('Listening for new incoming emails...'));
});
client.on('newEmail', (email) => {
console.log(chalk.yellowBright('You have a new email!'));
for(var prop in email){
console.log(chalk.gray('---------------------'));
console.log(chalk`{magentaBright From:} {gray ${email[prop].mail_from}}`);
console.log(chalk`{magentaBright Received at:} {gray ${email[prop].mail_date}}`);
console.log(chalk`{magentaBright Reply to:} {gray ${email[prop].reply_to}}`);
console.log(chalk`{magentaBright Subject:} {gray ${email[prop].mail_subject}}`);
console.log(chalk.gray('---------------------'));
console.log(chalk.gray(`${email[prop].mail_body}`));
client.delEmail(email[prop].mail_id).then( (response) => {
console.log(chalk.magentaBright('Email message marked as readed!'));
});
}
});