✉️ A Go library for email verification without sending any emails.
- 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
Use go get
to install this package.
go get -u github.com/innovation-upstream/email-verifier
Use Verify
method to verify an email address with different dimensions
package main
import (
"fmt"
"github.com/innovation-upstream/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)
}
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.
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
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 | ✅ | ❌ | ✅ | ✅ |
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.
This error can also be due to SMTP ports being blocked by the ISP, see the above answer.
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.
- trumail
- check-if-email-exists
- disposable domains from disposable/disposable
- free provider data from willwhite/freemail
For details on contributing to this repository, see the contributing guide.
This package is licensed under MIT license. See LICENSE for details.