Hi Sadhan, Initially Thanks a lot for the sharing knowledge, I follow you blog, and I have issue, that
I want to get the gmail body retrieve from simple javascript class, just emai body, I already get it , but can not user that in other class, I man without creating any connection I just want to get email body in other class, can I do it ?
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.
Hi Sadhan, Initially Thanks a lot for the sharing knowledge, I follow you blog, and I have issue, that
I want to get the gmail body retrieve from simple javascript class, just emai body, I already get it , but can not user that in other class, I man without creating any connection I just want to get email body in other class, can I do it ?
Thanks again,
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.