Skip to content

Instantly share code, notes, and snippets.

@JaiParakh
Created June 20, 2019 06:47
Show Gist options
  • Save JaiParakh/b420d72bf6842258004fdc4f1f2d65ff to your computer and use it in GitHub Desktop.
Save JaiParakh/b420d72bf6842258004fdc4f1f2d65ff to your computer and use it in GitHub Desktop.
const {google} = require('googleapis');
var base64 = require('js-base64').Base64;
const cheerio = require('cheerio');
var open = require('open');
var Mailparser = require('mailparser').MailParser;
class Check{
//auth is the constructor parameter.
constructor(auth){
this.me = 'Enter your email id.';
this.gmail = google.gmail({version: 'v1', auth});
this.auth = auth;
}
//Returns the mails in the user's inbox.
checkInbox(){
this.gmail.users.messages.list({
userId: this.me
}, (err, res) => {
if(!err){
console.log(res.data);
}
else{
console.log(err);
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment