Go library to verify email addresses through Email verification API provided by 3rd party services - abstractapi.com and hunter.io.
- Completely native (no 3rd party module dependencies)
- Client side rate limiting
- Ability to change rate limits
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)
}
}
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)
}
}
cd cmd/aapi_validate
go build
cd cmd/aapi_validate
./aapi_validate validate -apiKey API_KEY -email EMAIL
cd cmd/hunter_validate
go build
cd cmd/hunter_validate
./hunter_validate validate -apiKey API_KEY -email EMAIL