Iām very much eager about new tools and technologies. I love to work with the R&D Team. Till now my findings, I believe nothing is impossible just need focus, dedication, and time.
I didn't get your point properly! As far I guess if I not wrong you like to reuse that connection from other classes. I did not try that yet. Let me try first.
Thank you, for such types of motivational comment.
Iām very much eager about new tools and technologies. I love to work with the R&D Team. Till now my findings, I believe nothing is impossible just need focus, dedication, and time.
constImap=require('imap'),inspect=require('util').inspect;classMailConfig{server=newImap({user:'example@gmail.com',password:'password',host:'imap.gmail.com',port:993,tls:true,tlsOptions:{rejectUnauthorized:false},authTimeout:3000}).once('error',function(err){console.log('Source Server Error:- ',err);});constructor(){this.server.connect();}getServer(){returnthis.server;}}// export & access it from any classletconfig=newMailConfig();letmailServer=config.getServer();mailServer.once('ready',function(){mailServer.openBox('INBOX',true,function(err,box){if(err)throwerr;console.log('message','Source mail server ready');letf=mailServer.seq.fetch('1:*',{bodies:'HEADER.FIELDS (FROM TO SUBJECT DATE)',struct:true});f.on('message',function(msg,seqno){console.log('Message #%d',seqno);letprefix='(#'+seqno+') ';msg.on('body',function(stream,info){letbuffer='';stream.on('data',function(chunk){buffer+=chunk.toString('utf8');});stream.once('end',function(){console.log(prefix+'Parsed header: %s',inspect(Imap.parseHeader(buffer)));});});});})});
Iām very much eager about new tools and technologies. I love to work with the R&D Team. Till now my findings, I believe nothing is impossible just need focus, dedication, and time.
I didn't get your point properly! As far I guess if I not wrong you like to reuse that connection from other classes. I did not try that yet. Let me try first.
Thank you, for such types of motivational comment.
Hope you looking for this.
Hi Sadhan,
Really Thanks for the kind and quick response, Thanks a lot, That's what I asked.
Sounds Good! If you think I can help, feel free to knock me.