Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including mailboxes with all npm packages installed. Try it out:

var mailboxes = require("mailboxes")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

mailboxes v0.0.3

List primary better mailboxes, especially for GMail

node-mailboxes

List primary better mailboxes, especially for GMail, and It's based on andris9/inbox

Installation

$ npm install mailboxes

Usage

var mailboxes = require('mailboxes');
var inbox = require('inbox');
var client = inbox.createConnection(false, 'imap.gmail.com', {
  secureConnection: true,
  auth: yourauthOption
});

mailboxes(client, function(err, mailboxes) {
  // Then you would get a well-format folders.
});
client.connect();

Output format

{ 
  Inbox: { 
    name: 'Inbox', 
    path: 'INBOX', 
    type: 'Inbox', 
    delimiter: '/' 
  },
  'All Mail': { 
    name: 'All Mail',
    path: '[Gmail]/All Mail',
    type: 'All Mail',
    delimiter: '/' 
  },
  Drafts: { 
    name: 'Drafts',
    path: '[Gmail]/Drafts',
    type: 'Drafts',
    delimiter: '/' 
  },
  Flagged: { 
    name: 'Important',
    path: '[Gmail]/Important',
    type: 'Flagged',
    delimiter: '/' 
  },
  Sent: { 
    name: 'Sent Mail',
    path: '[Gmail]/Sent Mail',
    type: 'Sent',
    delimiter: '/' },
  Junk: { 
    name: 'Spam',
    path: '[Gmail]/Spam',
    type: 'Junk',
    delimiter: '/' },
  Trash: { 
    name: 'Trash',
    path: '[Gmail]/Trash',
    type: 'Trash',
    delimiter: '/' 
  }
}

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free