✉️ Fork of email-verifier with added functionality for handling large input emails
- All existing features of parent project
- Restapi for handling multiple emails
Use go get
to install this package.
go get -u github.com/X0EF/email-verifier
Use VerifyEmails
method to verify an email addresses with different dimensions
package main
import (
"fmt"
emailverifier "github.com/AfterShip/email-verifier"
)
var (
verifier = emailverifier.NewVerifier()
)
func main() {
emails := ["example@exampledomain.org"]
ret, err := verifier.VerifyEmails(emails)
if err != nil {
fmt.Println("verify email address failed, error is: ", err)
return
}
if !ret.Syntax.Valid {
fmt.Println("email address syntax is invalid")
return
}
fmt.Println("email validation result", ret)
/*
results: {
"email":"example@exampledomain.org",
"disposable":false,
"reachable":"unknown",
"role_account":false,
"free":false,
"syntax":{
"username":"example",
"domain":"exampledomain.org",
"valid":true
},
"has_mx_records":true,
"smtp":null,
"gravatar":null
}],
errors: null
*/
}
We provide a simple self-hosted API server script for reference.
The API interface is very simple. All you need to do is to send a GET request with the following URL.
The email
parameter would be the target email you want to verify.
POST to https://{your_host}/v1/bulk/verifications
Body
{emails: ["example@mail.com", "sample@email.com"]}
This package is licensed under MIT license.