GithubHelp home page GithubHelp logo

zacxdev / email-verifier Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aftership/email-verifier

0.0 1.0 1.0 1.32 MB

A Go library for email verification without sending any emails.

License: MIT License

Makefile 0.02% Go 99.94% Shell 0.04%

email-verifier's Introduction

email-verifier

โœ‰๏ธ A Go library for email verification without sending any emails.

Build Status Godoc Coverage Status Go Report Card license

Features

  • Email Address Validation: validates if a string contains a valid email.
  • Email Verification Lookup via SMTP: performs an email verification on the passed email
  • MX Validation: checks the DNS MX records for the given domain name
  • Misc Validation: including Free email provider check, Role account validation, Disposable emails address (DEA) validation
  • Email Reachability: checks how confident in sending an email to the address

Install

Use go get to install this package.

go get -u github.com/AfterShip/email-verifier

Usage

Basic usage

Use Verify method to verify an email address with different dimensions

package main

import (
    "fmt"

    "github.com/AfterShip/email-verifier"
)

var (
    verifier = emailverifier.NewVerifier()
)

func main() {

    email := "[email protected]"
    ret, err := verifier.Verify(email)
    if err != nil {
        fmt.Println("check email failed: ", err)
        return
    }

    fmt.Println("email validation result", ret)
}

Email verification Lookup

Use CheckSMTP to performs an email verification lookup via SMTP.

var (
    verifier = emailverifier.
        NewVerifier().
        EnableSMTPCheck()
)

func main() {

    domain := "domain.org"
    ret, err := verifier.CheckSMTP(domain)
    if err != nil {
        fmt.Println("check smtp failed: ", err)
        return
    }

    fmt.Println("smtp validation result: ", ret)

}

Note: because most of the ISPs block outgoing SMTP requests through port 25 to prevent email spamming, the module will not perform SMTP checking by default. You can initialize the verifier with EnableSMTPCheck() to enable such capability if port 25 is usable.

Misc Validation

To check if an email domain is disposable via IsDisposable

var (
    verifier = emailverifier.
        NewVerifier().
        EnableAutoUpdateDisposable()
)

func main() {
    domain := "domain.org"
    ret := verifier.IsDisposable(domain)
    fmt.Println("misc validation result: ", ret)
}

Note: It is possible to automatically update the disposable domains daily by initializing verifier with EnableAutoUpdateDisposable()

For more detailed documentation, please check on godoc.org ๐Ÿ‘‰ email-verifier

Similar Libraries Comparison

email-verifier trumail check-if-email-exists freemail
Features ใ€ฐ๏ธ ใ€ฐ๏ธ ใ€ฐ๏ธ ใ€ฐ๏ธ
Disposable email address validation โœ… โœ…, but not available in free lib โœ… โœ…
Disposable address autoupdate โœ… ๐Ÿค” โŒ โŒ
Free email provider check โœ… โœ…, but not available in free lib โŒ โœ…
Role account validation โœ… โŒ โœ… โŒ
Syntax validation โœ… โœ… โœ… โŒ
Email reachability โœ… โœ… โœ… โŒ
DNS records validation โœ… โœ… โœ… โŒ
Email deliverability โœ… โœ… โœ… โŒ
Mailbox disabled โœ… โœ… โœ… โŒ
Full inbox โœ… โœ… โœ… โŒ
Host exists โœ… โœ… โœ… โŒ
Catch-all โœ… โœ… โœ… โŒ
Gravatar โœ… โœ…, but not available in free lib โŒ โŒ
Typo check ๐Ÿ”œ โœ…, but not available in free lib โŒ โŒ
Honeyport dection ๐Ÿ”œ โŒ โŒ โŒ
Bounce email check ๐Ÿ”œ โŒ โŒ โŒ
Tech ใ€ฐ๏ธ ใ€ฐ๏ธ ใ€ฐ๏ธ ใ€ฐ๏ธ
Provide API ๐Ÿ”œ โœ… โœ… โŒ
Free API ๐Ÿ”œ โŒ โŒ โŒ
Language Go Go Rust JavaScript
Active maintain โœ… โŒ โœ… โœ…
High Performance โœ… โŒ โœ… โœ…

FAQ

The library hangs/takes a long time after 30 seconds when performing email verification lookup via SMTP

Most ISPs block outgoing SMTP requests through port 25 to prevent email spamming. email-verifier needs to have this port open to make a connection to the email's SMTP server. With the port being blocked, it is not possible to perform such checking, and it will instead hang until timeout error. Unfortunately, there is no easy workaround for this issue.

For more information, you may also visit this StackOverflow thread.

The output shows "connection refused" in the smtp.error field.

This error can also be due to SMTP ports being blocked by the ISP, see the above answer.

What does reachable: "unknown" means

This means that the server does not allow real-time verification of an email right now, or the email provider is a catch-all email server.

Credits

Contributing

For details on contributing to this repository, see the contributing guide.

License

This package is licensed under MIT license. See LICENSE for details.

email-verifier's People

Contributors

chuan-t avatar dependabot[bot] avatar lryong avatar neocn avatar nicjellz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.