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

emailvalidator

v0.1.3

Published

EmailValidator is a simple node.js helper library to check an email address's validity without sending a single email.

Downloads

58

Readme

EmailValidator

EmailValidator is a simple node.js helper library to check an email address's validity without sending a single email.

Why?

If you send commercial email you know getting your email delivered is very hard - even if you follow all the rules. A high bounce rate (above 3%) can cause your delivery rates to drop dramatically. By validating email addresses that your team may collect over the phone and hand enter into a CRM you can protect yourself and decrease your bounce rate. Thereby increasing your email marketing effectiveness.

Features

  • Very basic email syntax check.
  • Check for valid MX records
  • If no MX records are found, check for valid A record
  • Verify MX/A has a listening email server
  • Redis used as a cache to improve speed and avoid bombarding mail servers

Risks

It is possible that if you query a single provider too much that the email provider will block you. We've implemented a Redis cache to mitigate this.

It is possible that you perform a validity check when an ISP's SMTP server is down, inaccurately noting it as offline.

To do: Right now we just query the first MX record instead of all of them. The code should be refactored to loop through each MX record asynchronously. Anyone care to help?

Installation

setup redis

./src/redis-server /usr/redis-2.8.9/redis.conf

We'll just use the default port. If you have something custom, then you'll need to configure the connection.

Next, install the package

npm install emailvalidator

Using as a node module

In the simplest form you can just call:

var options = {
    externalIpAddress: '93.184.216.119', 
    redisPort: 6379, 
    redisHost: '127.0.0.1'
}
require('emailvalidator').checkEmailAddress('[email protected]', options, callback);

The parameters are optional, but should you lave a blank externalIpAddress you may affect the accuracy of the program.

To lookup your external IP address, just call

require('emailvalidator').getExternalIp(callback)

the callback is function(error, response)

the response object is:

{
    "email": "[email protected]",
    "valid": false,
    "reason": "no server to receive mail. cannot connect to mail exchanger"
}

Using as a Microservice

Built into this module is a webserver that responds to GET requests on /:email

To start this webserver automatically, just run npm start

Otherwise, you can run it programatically by calling

var options = {
    // defaults to 3000
    port: integer,
    // if null/empty we will look this up automatically
    externalIpAddress: '',
    // defaults to 127.0.0.1
    redisHost: integer,
    // defaults to 6379
    redisPort: integer
}

require('emailvalidator').startWebServer(options)