Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/reacherhq/check-if-email-exists

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.
https://github.com/reacherhq/check-if-email-exists

email email-validation email-validation-api email-verification email-verification-api email-verifier hacktoberfest

Last synced: about 1 month ago
JSON representation

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.

Lists

README

        

[![Crate](https://img.shields.io/crates/v/check-if-email-exists.svg)](https://crates.io/crates/check-if-email-exists)
[![Docs](https://docs.rs/check-if-email-exists/badge.svg)](https://docs.rs/check-if-email-exists)
[![Docker](https://img.shields.io/docker/v/reacherhq/backend?color=0db7ed&label=docker&sort=date)](https://hub.docker.com/r/reacherhq/backend)
[![Actions Status](https://github.com/reacherhq/check-if-email-exists/workflows/pr/badge.svg)](https://github.com/reacherhq/check-if-email-exists/actions)



reacher


check-if-email-exists


Check if an email address exists without sending any email.
Comes with a ⚙️ HTTP backend.




## 👉 Live Demo: https://reacher.email

This is open-source, but I also offer a **SaaS** solution that has `check-if-email-exists` packaged in a nice friendly web interface. If you are interested, find out more at [Reacher](https://reacher.email/?ref=github). If you have any questions, you can contact me at [email protected].


## Get Started

3 non-SaaS ways to get started with `check-if-email-exists`.

### 1. ⚙️ HTTP backend using Docker (popular method 🥇) [[Full docs](./backend/README.md)]

This option allows you to run a HTTP backend using Docker 🐳, on a cloud instance or your own server. Please note that outbound port 25 must be open.

```bash
docker run -p 8080:8080 reacherhq/backend:latest
```

Then send a `POST http://localhost:8080/v0/check_email` request with the following body:

```js
{
"to_email": "[email protected]",
"from_email": "[email protected]", // (optional) email to use in the `FROM` SMTP command, defaults to "[email protected]"
"hello_name": "my-server.com", // (optional) name to use in the `EHLO` SMTP command, defaults to "localhost"
"proxy": { // (optional) SOCK5 proxy to run the verification through, default is empty
"host": "my-proxy.io",
"port": 1080,
"username": "me", // (optional) Proxy username
"password": "pass" // (optional) Proxy password
},
"smtp_port": 587 // (optional) SMTP port to do the email verification, defaults to 25
}
```

### 2. Download the CLI [[Full docs](./cli/README.md)]

> Note: The CLI binary doesn't connect to any backend, it checks the email directly from your computer.

Head to the [releases page](https://github.com/reacherhq/check-if-email-exists/releases) and download the binary for your platform.

```bash
> $ check_if_email_exists --help
check_if_email_exists 0.9.1
Check if an email address exists without sending an email.

USAGE:
check_if_email_exists [FLAGS] [OPTIONS] [TO_EMAIL]
```

Check out the [dedicated README.md](./cli/README.md) for all options and flags.

### 3. Programmatic Usage [[Full docs](https://docs.rs/check-if-email-exists)]

In your own Rust project, you can add `check-if-email-exists` in your `Cargo.toml`:

```toml
[dependencies]
check-if-email-exists = "0.9"
```

And use it in your code as follows:

```rust
use check_if_email_exists::{check_email, CheckEmailInput, CheckEmailInputProxy};

async fn check() {
// Let's say we want to test the deliverability of [email protected].
let mut input = CheckEmailInput::new(vec!["[email protected]".into()]);

// Verify this email, using async/await syntax.
let result = check_email(&input).await;

// `result` is a `Vec`, where the CheckEmailOutput
// struct contains all information about our email.
println!("{:?}", result);
}
```

The reference docs are hosted on [docs.rs](https://docs.rs/check-if-email-exists).

## ✈️ JSON Output

The output will be a JSON with the below format, the fields should be self-explanatory. For `[email protected]` (note that it is disabled by Gmail), here's the exact output:

```json
{
"input": "[email protected]",
"is_reachable": "invalid",
"misc": {
"is_disposable": false,
"is_role_account": false
},
"mx": {
"accepts_mail": true,
"records": [
"alt3.gmail-smtp-in.l.google.com.",
"gmail-smtp-in.l.google.com.",
"alt1.gmail-smtp-in.l.google.com.",
"alt4.gmail-smtp-in.l.google.com.",
"alt2.gmail-smtp-in.l.google.com."
]
},
"smtp": {
"can_connect_smtp": true,
"has_full_inbox": false,
"is_catch_all": false,
"is_deliverable": false,
"is_disabled": true
},
"syntax": {
"domain": "gmail.com",
"is_valid_syntax": true,
"username": "someone",
"suggestion": null
}
}
```

## What Does This Tool Check?

| Included? | Feature | Description | JSON field |
| --------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| ✅ | **Email reachability** | How confident are we in sending an email to this address? Can be one of `safe`, `risky`, `invalid` or `unknown`. | `is_reachable` |
| ✅ | **Syntax validation** | Is the address syntactically valid? | `syntax.is_valid_syntax` |
| ✅ | **DNS records validation** | Does the domain of the email address have valid MX DNS records? | `mx.accepts_mail` |
| ✅ | **Disposable email address (DEA) validation** | Is the address provided by a known [disposable email address](https://en.wikipedia.org/wiki/Disposable_email_address) provider? | `misc.is_disposable` |
| ✅ | **SMTP server validation** | Can the mail exchanger of the email address domain be contacted successfully? | `smtp.can_connect_smtp` |
| ✅ | **Email deliverability** | Is an email sent to this address deliverable? | `smtp.is_deliverable` |
| ✅ | **Mailbox disabled** | Has this email address been disabled by the email provider? | `smtp.is_disabled` |
| ✅ | **Full inbox** | Is the inbox of this mailbox full? | `smtp.has_full_inbox` |
| ✅ | **Catch-all address** | Is this email address a [catch-all](https://debounce.io/blog/help/what-is-a-catch-all-or-accept-all/) address? | `smtp.is_catch_all` |
| ✅ | **Role account validation** | Is the email address a well-known role account? | `misc.is_role_account` |
| ✅ | **Gravatar Url** | The url of the [Gravatar](https://gravatar.com/) email address profile picture | `misc.gravatar_url` |
| ✅ | **Have I Been Pwned?** | Has this email been compromised in a [data breach](https://haveibeenpwned.com/)? | `misc.haveibeenpwned` |
| 🔜 | **Free email provider check** | Is the email address bound to a known free email provider? | [Issue #89](https://github.com/reacherhq/check-if-email-exists/issues/89) |
| 🔜 | **Syntax validation, provider-specific** | According to the syntactic rules of the target mail provider, is the address syntactically valid? | [Issue #90](https://github.com/reacherhq/check-if-email-exists/issues/90) |
| 🔜 | **Honeypot detection** | Does email address under test hide a [honeypot](https://en.wikipedia.org/wiki/Spamtrap)? | [Issue #91](https://github.com/reacherhq/check-if-email-exists/issues/91) |

## 🤔 Why?

Many online services (https://hunter.io, https://verify-email.org, https://email-checker.net) offer this service for a paid fee. Here is an open-source alternative to those tools.

## License

`check-if-email-exists`'s source code is provided under a **dual license model**.

### Commercial license

If you want to use `check-if-email-exists` to develop commercial sites, tools, and applications, the Commercial License is the appropriate license. With this option, your source code is kept proprietary. Purchase a `check-if-email-exists` Commercial License at https://reacher.email/pricing.

### Open source license

If you are creating an open-source application under a license compatible with the GNU Affero GPL license v3, you may use `check-if-email-exists` under the terms of the [AGPL-3.0](./LICENSE.AGPL).

[➡️ Read more](https://help.reacher.email/reacher-licenses) about Reacher's license.

## ❓ FAQ

#### What does `is_reachable: "unknown"` mean?

This means that the server does not allow real-time verification of an email right now. It may happen for multiple reasons: your IP is blacklisted, the SMTP port 25 is blocked, the email account is momentarily receiving too many emails (spam protection)... or the email provider simply does not allow real-time verification at all. The details of this `"unknown"` case can be found in the `smtp.error` and `mx.error` fields.

#### The library hangs/takes a long time/doesn't show anything after 1 minute.

Most ISPs block outgoing SMTP requests through port 25, to prevent spam. `check-if-email-exists` needs to have this port open to make a connection to the email's SMTP server, so won't work behind these ISPs, and will instead hang until it times out. There's unfortunately no easy workaround for this problem, see for example [this StackOverflow thread](https://stackoverflow.com/questions/18139102/how-to-get-around-an-isp-block-on-port-25-for-smtp). One solution is to rent a Linux cloud server with a static IP and no blocked ports, see for example our [Self-Host Guide](https://help.reacher.email/self-host-guide) for which cloud providers open port 25.

To see in detail what the binary is doing behind the scenes, run it in verbose mode with `RUST_LOG=debug` to see the logs.

#### I have another question.

Feel free to check out Reacher's [FAQ](https://help.reacher.email/faq).

## 🔨 Build From Source

Build the [CLI from source](./cli/README.md#build-from-source) or the [HTTP backend from source](./backend/README.md#build-from-source).