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 🙏

© 2025 – Pkg Stats / Ryan Hefner

smtpjs

v0.0.1

Published

testing tls, included a self signed cert run the client with this env variable `NODE_TLS_REJECT_UNAUTHORIZED=0`

Downloads

402

Readme

smtpjs

testing tls, included a self signed cert run the client with this env variable NODE_TLS_REJECT_UNAUTHORIZED=0

usage

basic usage

const Server = require('smtpjs')
const server = new Server()
// outputs >> [2020-06-22T02:39:08.611Z] [LOG]   - Server start on ip: 127.0.0.1 port: 1337

options

the 1st argument accepts a schema the second any dependencies

const Server = require('smtpjs')
const schema = {}
const dependencies = {
  logger: {...} // see `Logger Options`
}

const server = new Server(schema, dependencies)

Schema

events

theres all the smtp commands that fire if defined for example the HELO command

const schema = {
  events: {
    HELO (ctx) {
      // when server receives the `HELO` it runs this code block
      this.logger.debug(' - promise')
      return new Promise ((resolve, reject) => {
        this.logger.debug(' - timeout')
        setTimeout(() => {
          this.logger.info('wait 1 second')
          resolve('done')
        },1000)
      })
    }

    // outputs on HELO
    // [2020-06-22T03:01:21.523Z] [DEBUG] -  - promise
    // [2020-06-22T03:01:21.523Z] [DEBUG] -  - timeout
    // [2020-06-22T03:01:22.528Z] [INFO]  - wait 1 second
  }
}

not only are the stmp commands but there are 3 additional on connect, error, and done

connect

accepts a Socket object, which is the nodejs Socket with additional field id

const schema = {
  events: {
      connect (socket) {
      const ip = socket.remoteAddress
      const id = socket.id
      this.logger.log(`id: ${id} ip: ${ip}`)
    },
  }
}

error

accepts error object and the current status of the email

const schema = {
  events: {
      error (error, mail) {
      // log error?
      this.logger.log('Error', error)

      // still want to see what the mail is
      this.logger.log(mail)
    },
  }
}

SMTP Response Codes from and it's Definition:

220 - SMTP Service ready.
221 - Service closing.
250 - Requested action taken and completed.
251 - The recipient is not local to the server, but the server will accept and forward the message.
252 - The recipient cannot be verified, but the server accepts the message and attempts delivery.
354 - Start message input and end with .. This indicates that the server is ready to accept the message itself (after you have told it who it is from and where you want to to go).
421 - The service is not available and the connection will be closed.
450 - The requested command failed because the user's mailbox was unavailable (for example because it was locked). Try again later.
451 - The command has been aborted due to a server error. Not your fault. Maybe let the admin know.
452 - The command has been aborted because the server has insufficient system storage.
500 - The server could not recognize the command due to a syntax error.
501 - A syntax error was encountered in command arguments.
502 - This command is not implemented.
503 - The server has encountered a bad sequence of commands.
504 - A command parameter is not implemented.
521 - This host never accepts mail; a response by a dummy server.
541 - The message could not be delivered for policy reasons—typically a spam filter. (Only some SMTP servers return this error code.)
550 - The requested command failed because the user's mailbox was unavailable (for example because it was not found, or because the command was rejected for policy reasons).
551 - The recipient is not local to the server. The server then gives a forward address to try.
552 - The action was aborted due to exceeded storage allocation.
553 - The command was aborted because the mailbox name is invalid.
554 - The transaction failed. Blame it on the weather.
555 - The server does not recognize the email address format, and delivery is not possible.
556 - The message would have to be forwarded, but the receiving server will reject it.