让我们使用yapople获取一下,你的邮件列表吧代码如下:var Client = require('yapople').Client;
var _ = require('lodash');
var async = require('async');
var iconv = require('iconv-lite');
var Fetcher = module.exports = function(options){
this.options = _.assign(options,{port:995,tls:true,mailparser:true})
this.client = new Client(this.options)
this.mails = []
}
Fetcher.prototype.count = function(cb){
var self = this
self.client.connect(function(){
self.client.count(cb);
self.client.quit();
});
}
Fetcher.prototype.fetch = function(nums,cb){
var self = this;
self.client.connect(function(){
self.client.retrieve(nums,function(err,messages){
cb(err,messages);
self.client.quit();
})
});
}
Fetcher.prototype.list = function(number,cb){
var self = this;
self.client.connect(function(){
self.client.list(number,function(err,info){
cb(err,info);
self.client.quit();
})
});
}
Fetcher.prototype.getContent = function(date,cb){
var self = this;
self.client.connect(function(){
async.waterfall([
function(done){
self.client.count(function(err,count){
done(err,count);
});
},
function(count,done){
var nums = [];
var tmp = [];
for(var i=0;i