Skip to content

Go library to verify email addresses through Email verification API provided by 3rd party services such as abstractApi, hunter.io etc.

License

Notifications You must be signed in to change notification settings

rajan-goswami/email-validator

Repository files navigation

CI codecov Go Report Card Go Reference

email-validator

Go library to verify email addresses through Email verification API provided by 3rd party services - abstractapi.com and hunter.io.

Features

  • Completely native (no 3rd party module dependencies)
  • Client side rate limiting
  • Ability to change rate limits

How to use http clients

abstract.com client

import (
    "fmt"
    "log"
    "os"

    emailvalidator "github.com/r-goswami/email-validator"
)

func main() {
    apiKey :=  os.GetEnv("API_KEY")
    validator, err := emailvalidator.NewAbstractAPIClient(apiKey)
    if err != nil {
        log.Panic(err)
    }

    email := "abc@xyz.com"
    resp, err := validator.Validate(email)
    if err != nil {
        fmt.Println(err)
        return
    }

    if resp.IsValid() {
        fmt.Printf("\n%s is a valid email\n", email)
    }
}

hunter.io client

import (
    "fmt"
    "log"
    "os"

    emailvalidator "github.com/r-goswami/email-validator"
)

func main() {
    apiKey :=  os.GetEnv("API_KEY")
    validator, err := emailvalidator.NewHunterAPIClient(apiKey)
    if err != nil {
        log.Panic(err)
    }

    email := "abc@xyz.com"
    resp, err := validator.Validate(email)
    if err != nil {
        fmt.Println(err)
        return
    }

    if resp.IsValid() {
        fmt.Printf("\n%s is a valid email\n", email)
    }
}

How to check clients using commands

abstract.com client

Build

cd cmd/aapi_validate
go build

Run

cd cmd/aapi_validate
./aapi_validate validate -apiKey API_KEY -email EMAIL

hunter.io client

Build

cd cmd/hunter_validate
go build

Run

cd cmd/hunter_validate
./hunter_validate validate -apiKey API_KEY -email EMAIL

About

Go library to verify email addresses through Email verification API provided by 3rd party services such as abstractApi, hunter.io etc.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages