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

bgui

v1.0.7

Published

A tool to verify an email address exits via SMTP

Downloads

20

Readme

BGUI

This is a fork of email-verify and it has the following differences from the original project:

  • It's entirely written in TypeScript
  • It provides the response sent from the SMTP server in case of errors
  • It adds the BANNED_BY_SERVER error code, trying to parse the error message sent by the server.

Install

  • npm install bgui -g if you just want to use the CLI.
  • npm install bgui to use it in your app.

Usage

Callback

The callback is a function(err, info) that has an info object:

{
  "success": true // boolean
  "info": "[email protected] is a valid email" // A description of the result
  "addr": "[email protected]" // the address being verified
  "code": 1, // info code saying things on verification status, see infoCodes enum
  "lastResponse": "220 DB8EUR05FT061.mail.protection.outlook.com Microsoft ESMTP MAIL Service ready ...", // last SMTP response
}

Options

The options are:

  • port: integer, port to connect to. (default: 25)
  • sender: string, sender's email address. (default: [email protected]).
  • timeout: integer, socket timeout in milliseconds. (default: 0, that is no timeout).
  • fqdn: string, used as part of the HELO, defaults to mail.example.org.
  • dns: string | Array<string>, ip address or array of ip addresses (as strings), used to set the servers of the dns check
  • ignore: set an ending response code integer to ignore, such as 450 for greylisted emails.

Flow

The basic flow is as follows:

  1. Validate it is a proper email address
  2. Get the domain of the email
  3. Grab the DNS MX records for that domain
  4. Create a TCP connection to the smtp server
  5. Send a EHLO message
  6. Send a MAIL FROM message
  7. Send a RCPT TO message
  8. If they all validate, return an object with success: true. If any stage fails, the callback object will have success: false.

This module has tests with Jest. Run npm test and make sure you have a solid connection.

Use (also see the app.js file):

import { verify } from 'bgui';

verify('[email protected]').then((info) => {
  expect(info.success).toBeTruthy();
  expect(info.code).toBe(infoCodes.FINISHED_VERIFICATION);
  expect(info.lastResponse?.length !== undefined && info.lastResponse.length > 0).toBeTruthy();
  done();
});

For CLI usage:

bgui --help

Why this name?

It takes inspiration from Bernard Gui, an inquisitor. This service declares which emails must be condemned and set on fire.