{"id":13412667,"url":"https://github.com/AfterShip/email-verifier","last_synced_at":"2025-03-14T18:31:57.422Z","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":"2024-10-07T09:44:47.000Z","size":677,"stargazers_count":1210,"open_issues_count":19,"forks_count":154,"subscribers_count":34,"default_branch":"main","last_synced_at":"2024-10-29T15:38:01.907Z","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}},"created_at":"2020-12-18T08:47:28.000Z","updated_at":"2024-10-29T13:02:35.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,"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","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243482874,"owners_count":20297900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-07-30T20:01:27.581Z","updated_at":"2025-03-14T18:31:57.382Z","avatar_url":"https://github.com/AfterShip.png","language":"Go","funding_links":[],"categories":["开源类库","Email","电子邮件","Go","Deliverability","Tools","Relational Databases"],"sub_categories":["邮件","Search and Analytic Databases","检索及分析资料库","Email Verification","Advanced Console UIs","Misc"],"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## 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### 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?timeout=5s`\n\nThe protocol could be socks5, socks4 and socks4a.\n\n```go\nvar (\n    verifier = emailverifier.\n        NewVerifier().\n        EnableSMTPCheck().\n    \tProxy(\"socks5://user:password@127.0.0.1:1080?timeout=5s\")\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### 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 [ivolo/disposable-email-domains](https://github.com/ivolo/disposable-email-domains)\n- free provider data from [willwhite/freemail](https://github.com/willwhite/freemail)\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"}