email-verifier
exposes the core service to verify an email. You can get that using:
go get github.com/hsnice16/email-verifier/core/service
package main
import (
"fmt"
"github.com/hsnice16/email-verifier/core/service"
)
func main() {
fmt.Printf("Hello, Email Verifier\n\n")
email := "xyz@"
result, err := service.VerifyEmail(email, service.VerifyEmailOptions{ValidateRegex: true})
fmt.Printf("Is %+v a Valid Email?: %v\n", email, result)
fmt.Printf("%+v\n\n", err)
email = "xyz@example.com"
result, err = service.VerifyEmail(email, service.VerifyEmailOptions{
ValidateRegex: true,
ValidateMxRecord: true,
ValidateSmtpRunning: true,
},
)
fmt.Printf("Is %+v a Valid Email?: %v\n", email, result)
fmt.Println(err)
}
Hello, Email Verifier
Is xyz@ a Valid Email?: false
Invalid Email Address: Regex check failed
Is xyz@example.com a Valid Email?: false
Invalid Email Address: Mx record not found
git clone git@github.com:hsnice16/email-verifier.git
cd email-verifier
You will need docker on your local machine for this.
docker build -t hsnice16/email-verifier:1.0 .
docker run -p 8080:8080 hsnice16/email-verifier:1.0 -- service
• • •
go install
cmd
cmd service
If you found this project helpful, then do consider sponsoring it - Sponsor
And, give it a star 🌟