{"id":15035499,"url":"https://github.com/aftership/email-verifier","last_synced_at":"2026-10-14T16:25:09.219Z","repository":{"id":37374805,"uuid":"322539168","full_name":"AfterShip/email-verifier","owner":"AfterShip","description":":white_check_mark: A Go library for email verification without sending any emails.","archived":false,"fork":false,"pushed_at":"2026-09-15T02:50:13.000Z","size":1502,"stargazers_count":1622,"open_issues_count":26,"forks_count":238,"subscribers_count":33,"default_branch":"main","last_synced_at":"2026-09-22T22:42:35.482Z","etag":null,"topics":["disposable","email","go","smtp","validation","verification","verifier"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AfterShip.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-18T08:47:28.000Z","updated_at":"2026-09-19T02:40:43.000Z","dependencies_parsed_at":"2024-05-04T05:32:50.000Z","dependency_job_id":"1db759a3-a227-49f8-9dd7-4ad0848503e0","html_url":"https://github.com/AfterShip/email-verifier","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/AfterShip/email-verifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfterShip%2Femail-verifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfterShip%2Femail-verifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfterShip%2Femail-verifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfterShip%2Femail-verifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AfterShip","download_url":"https://codeload.github.com/AfterShip/email-verifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AfterShip%2Femail-verifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":344794859,"owners_count":38319517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-10-03T21:59:58.778Z","status":"online","status_checked_at":"2026-10-14T02:00:06.392Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["disposable","email","go","smtp","validation","verification","verifier"],"created_at":"2024-09-24T20:28:48.731Z","updated_at":"2026-10-14T16:25:09.196Z","avatar_url":"https://github.com/AfterShip.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# email-verifier\n\n✉️ A Go library for email verification without sending any emails.\n\n[![Build Status](https://github.com/AfterShip/email-verifier/workflows/CI%20Actions/badge.svg)](https://github.com/AfterShip/email-verifier/actions)\n[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/AfterShip/email-verifier)\n[![Coverage Status](https://coveralls.io/repos/github/AfterShip/email-verifier/badge.svg?t=VTgVfL)](https://coveralls.io/github/AfterShip/email-verifier)\n[![Go Report Card](https://goreportcard.com/badge/github.com/AfterShip/email-verifier)](https://goreportcard.com/report/github.com/AfterShip/email-verifier)\n[![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://github.com/AfterShip/email-verifier/blob/main/LICENSE)\n\n## Features\n\n- Email Address Validation: validates if a string contains a valid email.\n- Email Verification Lookup via SMTP: performs an email verification on the passed email (catchAll detection enabled by default)\n- MX Validation: checks the DNS MX records for the given domain name\n- Misc Validation: including Free email provider check, Role account validation, Disposable emails address (DEA) validation\n- Email Reachability: checks how confident in sending an email to the address\n\n## Install\n\nUse `go get` to install this package.\n\n```shell script\ngo get -u github.com/AfterShip/email-verifier\n```\n\n### Supported Go versions\n\nThe three most recent Go releases, currently **1.25, 1.26 and 1.27**, each covered by CI.\n`go.mod` requires the oldest of them, so an older toolchain will refuse to build this module.\n\n## Usage\n\n### Basic usage\n\nUse `Verify` method to verify an email address with different dimensions\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\n\temailverifier \"github.com/AfterShip/email-verifier\"\n)\n\nvar (\n\tverifier = emailverifier.NewVerifier()\n)\n\n\nfunc main() {\n\temail := \"example@exampledomain.org\"\n\n\tret, err := verifier.Verify(email)\n\tif err != nil {\n\t\tfmt.Println(\"verify email address failed, error is: \", err)\n\t\treturn\n\t}\n\tif !ret.Syntax.Valid {\n\t\tfmt.Println(\"email address syntax is invalid\")\n\t\treturn\n\t}\n\n\tfmt.Println(\"email validation result\", ret)\n\t/*\n\t\tresult is:\n\t\t{\n\t\t\t\"email\":\"example@exampledomain.org\",\n\t\t\t\"disposable\":false,\n\t\t\t\"reachable\":\"unknown\",\n\t\t\t\"role_account\":false,\n\t\t\t\"free\":false,\n\t\t\t\"syntax\":{\n\t\t\t\"username\":\"example\",\n\t\t\t\t\"domain\":\"exampledomain.org\",\n\t\t\t\t\"valid\":true\n\t\t\t},\n\t\t\t\"has_mx_records\":true,\n\t\t\t\"smtp\":null,\n\t\t\t\"gravatar\":null\n\t\t}\n\t*/\n}\n```\n\n### Email verification Lookup\n\nUse `CheckSMTP` to performs an email verification lookup via SMTP.\n\n```go\nvar (\n    verifier = emailverifier.\n        NewVerifier().\n        EnableSMTPCheck()\n)\n\nfunc main() {\n\n    domain := \"domain.org\"\n    username := \"username\"\n    ret, err := verifier.CheckSMTP(domain, username)\n    if err != nil {\n        fmt.Println(\"check smtp failed: \", err)\n        return\n    }\n\n    fmt.Println(\"smtp validation result: \", ret)\n\n}\n```\n\nIf you want to disable catchAll checking, use the `DisableCatchAllCheck()` switch (in effect only when SMTP verification is enabled).\n\n```go\n verifier = emailverifier.\n        NewVerifier().\n        EnableSMTPCheck().\n        DisableCatchAllCheck()\n```\n\n\u003e 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, \n\u003e or use a socks proxy to connect over SMTP\n\n\u003e Note: set `FromEmail()` and `HelloName()` before verifying at any volume. The defaults are\n\u003e `user@example.org` and `localhost`, and `example.org` is reserved by RFC 2606, so a server\n\u003e that validates the sender can reject the whole exchange before it ever considers the\n\u003e address you asked about. Rejections of this kind arrive at `MAIL FROM` and name the sender\n\u003e or the connecting host rather than the recipient, for example\n\u003e `550 5.7.25 Forward-confirmed reverse DNS failed` or\n\u003e `550 5.7.1 Service unavailable, Client host [...] blocked using Spamhaus`. Use a domain you\n\u003e control, with a PTR record for the IP you connect from.\n\n### Use a SOCKS5 proxy to verify email \n\nSupport setting a SOCKS5 proxy to verify the email, proxyURI should be in the format: `socks5://user:password@127.0.0.1:1080`\n\nThe scheme must be `socks5` or `socks5h`, the only two `golang.org/x/net/proxy` resolves.\nAnything else, `socks4` and `socks4a` included, fails the dial with `proxy: unknown scheme`;\nadd it with [`proxy.RegisterDialerType`](https://pkg.go.dev/golang.org/x/net/proxy#RegisterDialerType)\nbefore calling `Proxy()`.\n\n```go\nvar (\n    verifier = emailverifier.\n        NewVerifier().\n        EnableSMTPCheck().\n    \tProxy(\"socks5://user:password@127.0.0.1:1080\")\n)\n\nfunc main() {\n\n    domain := \"domain.org\"\n    username := \"username\"\n    ret, err := verifier.CheckSMTP(domain, username)\n    if err != nil {\n        fmt.Println(\"check smtp failed: \", err)\n        return\n    }\n\n    fmt.Println(\"smtp validation result: \", ret)\n\n}\n```\n\nTwo things to know about the proxy:\n\n\u003e **A query string in the proxy URI is ignored.** `golang.org/x/net/proxy` reads only the\n\u003e scheme, credentials and host, so a `?timeout=5s` has no effect. Use `ConnectTimeout()` and\n\u003e `OperationTimeout()` instead.\n\n\u003e **DNS does not go through the proxy.** Only the connection to the mail server does, so MX\n\u003e lookups still leave from the local machine. To route them through the proxy as well, dial\n\u003e your DNS server over TCP through it — SOCKS5 carries TCP, and Go frames DNS over a\n\u003e non-packet connection per RFC 7766:\n\u003e\n\u003e ```go\n\u003e socksDialer, err := proxy.SOCKS5(\"tcp\", \"127.0.0.1:1080\", nil, proxy.Direct)\n\u003e if err != nil {\n\u003e     return err\n\u003e }\n\u003e verifier = emailverifier.\n\u003e     NewVerifier().\n\u003e     EnableSMTPCheck().\n\u003e     Proxy(\"socks5://127.0.0.1:1080\").\n\u003e     Resolver(\u0026net.Resolver{\n\u003e         PreferGo: true,\n\u003e         Dial: func(ctx context.Context, network, address string) (net.Conn, error) {\n\u003e             // ignore network, which may be \"udp\": SOCKS5 CONNECT carries TCP only\n\u003e             return socksDialer.Dial(\"tcp\", \"8.8.8.8:53\")\n\u003e         },\n\u003e     })\n\u003e ```\n\u003e\n\u003e Each lookup opens a TCP connection through the proxy, so this costs more than plain UDP DNS.\n\n### Use a custom DNS resolver\n\nBy default, the verifier uses `net.DefaultResolver` (the platform's system-configured DNS resolver) for MX lookups and direct SMTP host lookups. You can override this behaviour by supplying your own `*net.Resolver` via `Resolver()`, for example to query a specific DNS server. When a proxy is configured, SMTP hostname resolution follows the proxy path rather than this resolver. MX record lookups always use this resolver, whether or not a proxy is set.\n\n```go\nvar (\n    verifier = emailverifier.\n        NewVerifier().\n        EnableSMTPCheck().\n        Resolver(\u0026net.Resolver{\n            PreferGo: true,\n            Dial: func(ctx context.Context, network, address string) (net.Conn, error) {\n                d := net.Dialer{}\n                return d.DialContext(ctx, network, \"8.8.8.8:53\")\n            },\n        })\n)\n\nfunc main() {\n\n    domain := \"domain.org\"\n    username := \"username\"\n    ret, err := verifier.CheckSMTP(domain, username)\n    if err != nil {\n        fmt.Println(\"check smtp failed: \", err)\n        return\n    }\n\n    fmt.Println(\"smtp validation result: \", ret)\n\n}\n```\n\n\u003e Note: `PreferGo: true` is doing real work here, it is not boilerplate. MX record lookups always\n\u003e go through Go's own DNS client, so a custom `Dial` is honoured for those either way. Resolving\n\u003e the mail server's hostname to an IP for the TCP connection is different: without `PreferGo` that\n\u003e step may use the system (cgo) resolver, which ignores `Dial` entirely and quietly falls back to\n\u003e `/etc/resolv.conf`. Even with it set, `/etc/hosts` is still consulted before DNS, so a host\n\u003e listed there never reaches your resolver.\n\n### Misc Validation\n\nTo check if an email domain is disposable via `IsDisposable`\n\n```go\nvar (\n    verifier = emailverifier.\n        NewVerifier().\n        EnableAutoUpdateDisposable()\n)\n\nfunc main() {\n    domain := \"domain.org\"\n    if verifier.IsDisposable(domain) {\n        fmt.Printf(\"%s is a disposable domain\\n\", domain)\n        return\n    }\n    fmt.Printf(\"%s is not a disposable domain\\n\", domain)\n}\n```\n\n\u003e Note: It is possible to automatically update the disposable domains daily by initializing verifier with `EnableAutoUpdateDisposable()`\n\n### Suggestions for domain typo\n\nWill check for typos in an email domain in addition to evaluating its validity. \nIf we detect a possible typo, you will find a non-empty \"suggestion\" field in the validation result containing what we believe to be the correct domain.\nAlso, you can use the `SuggestDomain()` method alone to check the domain for possible misspellings\n\n```go\nfunc main() {\n    domain := \"gmai.com\"\n    suggestion := verifier.SuggestDomain(domain) \n    // suggestion should be `gmail.com`\n    if suggestion != \"\" {\n        fmt.Printf(\"domain %s is misspelled, right domain is %s. \\n\", domain, suggestion)\n        return \n    }\n    fmt.Printf(\"domain %s has no possible misspellings. \\n\", domain)\n}\n\n```\n\n\u003e Note: When using the `Verify()` method, domain typo checking is not enabled by default, you can enable it in a verifier with `EnableDomainSuggest()`\n \nFor more detailed documentation, please check on godoc.org 👉 [email-verifier](https://godoc.org/github.com/AfterShip/email-verifier)\n\n## API \n\nWe provide a simple **self-hosted** [API server](https://github.com/AfterShip/email-verifier/tree/main/cmd/apiserver) script for reference.\n\nThe API interface is very simple. All you need to do is to send a GET request with the following URL.\n\nThe `email` parameter would be the target email you want to verify.\n\n`https://{your_host}/v1/{email}/verification`\n\n## Similar Libraries Comparison\n\n|                                     | [email-verifier](https://github.com/AfterShip/email-verifier) | [trumail](https://github.com/trumail/trumail) | [check-if-email-exists](https://reacher.email/) | [freemail](https://github.com/willwhite/freemail) |\n| ----------------------------------- | :----------------------------------------------------------: | :-------------------------------------------: | :---------------------------------------------: | :-----------------------------------------------: |\n| **Features**                        |                              〰️                              |                      〰️                       |                       〰️                        |                        〰️                         |\n| Disposable email address validation |                              ✅                               |       ✅, but not available in free lib        |                        ✅                        |                         ✅                         |\n| Disposable address autoupdate       |                              ✅                               |                       🤔                       |                        ❌                        |                         ❌                         |\n| Free email provider check           |                              ✅                               |       ✅, but not available in free lib        |                        ❌                        |                         ✅                         |\n| Role account validation             |                              ✅                               |                       ❌                       |                        ✅                        |                         ❌                         |\n| Syntax validation                   |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| Email reachability                  |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| DNS records validation              |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| Email deliverability                |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| Mailbox disabled                    |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| Full inbox                          |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| Host exists                         |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| Catch-all                           |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| Gravatar                            |                              ✅                               |       ✅, but not available in free lib        |                        ❌                        |                         ❌                         |\n| Typo check                          |                              ✅                              |       ✅, but not available in free lib        |                        ❌                        |                         ❌                         |\n| Use proxy to connect over SMTP      |                              ✅                              |                        ❌                       |                        ✅                        |                         ❌                         |\n| Honeyport dection                   |                              🔜                               |                       ❌                       |                        ❌                        |                         ❌                         |\n| Bounce email check                  |                              🔜                               |                       ❌                       |                        ❌                        |                         ❌                         |\n| **Tech**                            |                              〰️                              |                      〰️                       |                       〰️                        |                        〰️                         |\n| Provide API                         |                              ✅                               |                       ✅                       |                        ✅                        |                         ❌                         |\n| Free API                            |                              ✅                               |                       ❌                       |                        ❌                        |                         ❌                         |\n| Language                            |                              Go                              |                      Go                       |                      Rust                       |                       JavaScript                        |\n| Active maintain                     |                              ✅                               |                       ❌                       |                        ✅                        |                         ✅                         |\n| High Performance                    |                              ✅                               |                       ❌                       |                        ✅                        |                         ✅                         |\n\n\n\n## FAQ\n\n#### The library hangs/takes a long time after 30 seconds when performing email verification lookup via SMTP\n\nMost 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.\n\nFor more information, you may also visit [this StackOverflow thread](https://stackoverflow.com/questions/18139102/how-to-get-around-an-isp-block-on-port-25-for-smtp).\n\n#### The output shows `\"connection refused\"` in the `smtp.error` field.\n\nThis error can also be due to SMTP ports being blocked by the ISP, see the above answer.\n\n#### What does reachable: \"unknown\" means\n\nThis 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.\n\n## Credits\n\n- [trumail](https://github.com/trumail/trumail)\n- [check-if-email-exists](https://github.com/amaurymartiny/check-if-email-exists)\n- [mailcheck](https://github.com/mailcheck/mailcheck)\n- disposable domains from [disposable/disposable-email-domains](https://github.com/disposable/disposable-email-domains), both for the generated list and for `EnableAutoUpdateDisposable()`, less the few real providers it misclassifies (see `cmd/build_metadata/disposable_allowlist.txt`)\n- free provider data from [HubSpot's free email domain list](https://f.hubspotusercontent40.net/hubfs/2832391/Marketing/Lead-Capture/free-domains-2.csv) and [tbrianjones/free_email_provider_domains](https://gist.github.com/tbrianjones/5992856), plus carrier and portal mailboxes vendored from [Kikobeats/free-email-domains](https://github.com/Kikobeats/free-email-domains)\n\n## Contributing\n\nFor details on contributing to this repository, see the [contributing guide](https://github.com/AfterShip/email-verifier/blob/main/CONTRIBUTING.md).\n\n## License\n\nThis package is licensed under MIT license. See [LICENSE](https://github.com/AfterShip/email-verifier/blob/main/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faftership%2Femail-verifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faftership%2Femail-verifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faftership%2Femail-verifier/lists"}