npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@evo-team-corp/poplib

v1.0.3

Published

POP3 client library for Node.js

Downloads

10

Readme

@evo-team-corp/poplib

Another POP3 library. It's a fork of durban89/node-poplib but with socks proxy support.

The design propose of the library is simplicity. A lot of common tasks with you POP3 mailbox doesn't require knowledge of the eleven POP3 commands. You just want to retrieve some messages from your mailbox and that's all! So here is quick example how to do this with 'node-poplib-gowhich':

var Client = require('@evo-team-corp/poplib').Client;
var client = new Client({
  hostname: 'pop.mail.ru',
  port:  995,
  tls: true,
  mailparser: true,
  username: 'username',
  password: 'password'
});
client.connect(function() {
  client.retrieveAll(function(err, messages) {
    messages.forEach(function(message) {
      console.log(message.subject);
    });
    client.quit();
  })
})

Also this is a callback-driven and command-queued library instead of poplib So you can run methods in chain, don't think about already running command and get what you want in callback instead of putting somewhere event-listener functions to retrieve data.

Uses the last TLS Api (since crypto.createCredentials is deprecated), so it works only with node.js v.0.12 or later.

Installation

npm install @evo-team-corp/poplib

Constructor properties

When you create new Client object you should pass an object which describes connection properties.

  • hostname - string - mailserver hostname
  • port - number - port, usually 110 or 995 for TLS connection
  • tls - boolean - use TLS encryption
  • username - string - mailbox username
  • password - string - mailbox password
  • socksHost - string - socks proxy host (WARNING: proxy doesn't work with TLS enabled)
  • socksPort - number - socks proxy port
  • socksUsername - string - socks proxy username (optional)
  • socksPassword - string - socks proxy password (optional)

Properties

  • connected - boolean - connect and login state

Methods

connect(callback)

  • callback - function(err)

Connect to the mailserver using hostname and port. Starts TLS connection if tls property is true. Then login into your mailbox using credentials properties username and password.

count(callback)

  • callback - function(err, count)

Returns a count of the messages in the mailbox

retrieve(what, callback)

  • what - number or array of numbers - message number, or an array of message numbers
  • callback - function(err, messages)

Retrieve a message/messages by its number/numbers. If the mailparser argument is true returned messages will be parsed and looks like an objects. Otherwise it will be strings. Notice that results are sparse array with indexes representing message numbers. You can access message with its number like that messages[number] and use all HOF like this messages.map(function(mail, num){ return [num, mail.subject]; }). Or you can represent it like normal array with construction like this: messages.filter(function(a){ return a'; })

retrieveAll(callback)

  • callback - function(err, messages)

Retrieve all messages in mailbox. Result is a sparse array starting from 1.

delete(what, callback)

  • what - number or array of numbers - message number, or an array of message numbers
  • callback - function(err, messages)

Delete a message/messages by its number/numbers. If you delete several messages and get an error for some message, all you delete transaction will be reset.

Note that if your connection to the server is broken at all then the messages will not actually be deleted. You need to cleanly disconnect from the mail server for this to happen.

deleteAll(callback)

  • callback - function(err, statuses)

Delete all messages in mailbox.

retrieveAndDeleteAll(callback)

  • callback - function(err, messages)

Retrieve and delete all messages in mailbox. Result is a sparse array starting from 1. In a callback function you'll get an error message or an array of retrieved emails. If you get an error for some reason, all you delete transaction will be reset.

list(number, callback)

  • number - number (optional) - message number
  • callback - function(err, info)

Returns length of a message in octets. If no number passed, list returns an object contains message numbers as a keys and message lengths as a values

quit(callback)

  • callback - function(err)

Finish current session and disconnect. All messages marked as deleted after this command will be erased.

Protocol methods

retr(what, callback)

  • what - number or string - message number
  • callback - function(err, message)

Retrieve full message by its number.

stat(callback)

  • what - number or string - message number
  • callback - function(err, stat)

Returns an stat object representing the number of messages currently in the mailbox (count property) and the size in bytes (length property).

top(number, linesCount, callback)

  • number - number or string - message number
  • linesCount - number or string - the number of lines of the message body you would like returned
  • callback - function(err)

Retrieve part of the message including headers, or only headers.

dele(number, callback)

  • number - number or string - message number
  • callback - function(err, response)

Delete a message by its number.