Skip to content

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

chore: Prepare publishing to crates.io (#73)

Amaury Martiny61e0b6418000
diff --git a/.travis.yml b/.travis.yml
index 1ff08fb0..7914dd80 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@ sudo: required
env:
global:
# TODO Update this to match the name of your project.
- - CRATE_NAME=check_if_email_exists
+ - CRATE_NAME=check-if-email-exists
matrix:
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
diff --git a/Cargo.lock b/Cargo.lock
index 024811fb..309d1af5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -118,18 +118,7 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "check_if_email_exists"
-version = "0.4.0"
-dependencies = [
- "check_if_email_exists_core 0.4.0",
- "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "check_if_email_exists_core"
+name = "check-if-email-exists"
version = "0.4.0"
dependencies = [
"lettre 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -144,10 +133,21 @@ dependencies = [
]
[[package]]
-name = "check_if_email_exists_serverless"
+name = "check-if-email-exists-cli"
+version = "0.4.0"
+dependencies = [
+ "check-if-email-exists 0.4.0",
+ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "check-if-email-exists-serverless"
version = "0.4.0"
dependencies = [
- "check_if_email_exists_core 0.4.0",
+ "check-if-email-exists 0.4.0",
"lambda_http 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lambda_runtime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -155,10 +155,10 @@ dependencies = [
]
[[package]]
-name = "check_if_email_exists_test_suite"
+name = "check-if-email-exists-test-suite"
version = "0.4.0"
dependencies = [
- "check_if_email_exists_core 0.4.0",
+ "check-if-email-exists 0.4.0",
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
]
diff --git a/Cargo.toml b/Cargo.toml
index 77839e52..3dfac03b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,13 +1,15 @@
[package]
-name = "check_if_email_exists"
+name = "check-if-email-exists-cli"
version = "0.4.0"
-authors = ["Amaury Martiny <[email protected]>"]
-description = "Check if an email address exists without sending any email"
edition = "2018"
publish = false
+[[bin]]
+name = "check_if_email_exists"
+path = "src/main.rs"
+
[dependencies]
-check_if_email_exists_core = { path = "core" }
+check-if-email-exists = { path = "core" }
clap = { version = "2.32", features = ["yaml"] }
env_logger = "0.7"
serde = "1.0"
diff --git a/README.md b/README.md
index c7d43ed2..aa599fd5 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
-# check_if_email_exists
+# check-if-email-exists
Check if an email address exists before sending the email.
-[![](https://img.shields.io/travis/amaurymartiny/check_if_email_exists.svg)](https://travis-ci.org/amaurymartiny/check_if_email_exists)
-[![](https://ci.appveyor.com/api/projects/status/github/amaurymartiny/check_if_email_exists?branch=master&svg=true)](https://ci.appveyor.com/project/amaurymartiny/check-if-email-exists-a08kp)
-![License](https://img.shields.io/github/license/amaurymartiny/check_if_email_exists.svg)
+[![Crate](https://img.shields.io/crates/v/check-if-email-exists.svg)](https://crates.io/crates/check-if-email-exists)
+[![](https://img.shields.io/travis/amaurymartiny/check-if-email-exists.svg)](https://travis-ci.org/amaurymartiny/check-if-email-exists)
+[![](https://ci.appveyor.com/api/projects/status/github/amaurymartiny/check-if-email-exists?branch=master&svg=true)](https://ci.appveyor.com/project/amaurymartiny/check-if-email-exists-a08kp)
+![License](https://img.shields.io/github/license/amaurymartiny/check-if-email-exists.svg)
[![](https://img.shields.io/badge/Buy%20me%20a%20tree-%F0%9F%8C%B3-lightgreen)](https://offset.earth/amaurymartiny)
#### 👉 Try it here: https://reacher.now.sh/api/verify/demo?toEmail=EMAIL
@@ -19,11 +20,11 @@ Many online services (https://hunter.io, http://verify-email.org, http://email-c
## Download the binary
-Head to the [releases page](https://github.com/amaurymartiny/check_if_email_exists/releases) and download the binary for your platform.
+Head to the [releases page](https://github.com/amaurymartiny/check-if-email-exists/releases) and download the binary for your platform.
> Note: The binary doesn't connect to the above serverless backend, it checks the mail directly from your computer.
-## Usage
+## CLI Usage
Make sure you have [`openssl`](https://www.openssl.org/) installed.
@@ -60,7 +61,7 @@ The output will be a JSON with the following format, for `[email protected]` (no
"has_full_inbox": false,
"is_catch_all": false,
"is_deliverable": false,
- "is_disabled": true,
+ "is_disabled": true
},
"syntax": {
"address": "[email protected]",
@@ -79,17 +80,37 @@ To show debug logs when running the binary, run:
RUST_LOG=debug check_if_email_exists [OPTIONS] <TO_EMAIL>
```
+## Usage as a Library
+
+In your own Rust project, you can add `check-if-email-exists` in your `Cargo.toml`:
+
+```toml
+check-if-email-exists = "0.4"
+```
+
+And use it in your code as follows:
+
+```rust
+
+use check_if_email_exists::email_exists;
+
+// First arg is the email we want to check, second arg is the FROM email used in the SMTP connection
+let checked = email_exists("[email protected]", "[email protected]");
+
+println!({:?}, checked); // `checked` is a SingleEmail struct
+```
+
## FAQ
-### The binary hangs/takes a long time/doesn't show anything after 1 minute.
+### The library hangs/takes a long time/doesn't show anything after 1 minute.
-Most ISPs block outgoing SMTP requests through ports 25, 587 and 465, to prevent spam. `check_if_email_exists` needs to have these ports 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.
+Most ISPs block outgoing SMTP requests through ports 25, 587 and 465, to prevent spam. `check-if-email-exists` needs to have these ports 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.
To see in details what the binary is doing behind the scenes, run it in [verbose mode](#verbose-mode) to see the logs.
## Legacy Bash Script
-The 1st version of this tool was a simple bash script which made a telnet call. If you would like to use that simpler version, have a look at the [`legacy`](https://github.com/amaurymartiny/check_if_email_exists/tree/legacy) branch. The reasons for porting the bash script to the current codebase are explained [in this issue](https://github.com/amaurymartiny/check_if_email_exists/issues/4).
+The 1st version of this tool was a simple bash script which made a telnet call. If you would like to use that simpler version, have a look at the [`legacy`](https://github.com/amaurymartiny/check-if-email-exists/tree/legacy) branch. The reasons for porting the bash script to the current codebase are explained [in this issue](https://github.com/amaurymartiny/check-if-email-exists/issues/4).
## Build From Source
@@ -97,14 +118,14 @@ First, [install Rust](https://www.rust-lang.org/tools/install); you'll need Rust
```bash
# Download the code
-$ git clone https://github.com/amaurymartiny/check_if_email_exists
-$ cd check_if_email_exists
+$ git clone https://github.com/amaurymartiny/check-if-email-exists
+$ cd check-if-email-exists
# Build in release mode
$ cargo build --release
# Run the binary
-$ ./target/release/check_if_email_exists --help
+$ ./target/release/check-if-email-exists --help
```
## License
diff --git a/appveyor.yml b/appveyor.yml
index 14430ec8..a9c98a6d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -8,7 +8,7 @@ environment:
RUST_VERSION: stable
# TODO Update this to match the name of your project.
- CRATE_NAME: check_if_email_exists
+ CRATE_NAME: check-if-email-exists
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
# don't need
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 584fcc70..1cc04bbd 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -1,10 +1,20 @@
[package]
-name = "check_if_email_exists_core"
+name = "check-if-email-exists"
version = "0.4.0"
authors = ["Amaury Martiny <[email protected]>"]
+categories = ["email"]
description = "Check if an email address exists without sending any email"
+documentation = "http://docs.rs/check-if-email-exists"
edition = "2018"
-publish = false
+keywords = ["email", "smtp", "mx", "verification"]
+license = "GPL-3.0"
+publish = true
+readme = "../README.md"
+repository = "https://github.com/amaurymartiny/check-if-email-exists"
+
+[badges]
+appveyor = { repository = "amaurymartiny/check-if-email-exists", service = "github" }
+travis-ci = { repository = "amaurymartiny/check-if-email-exists", service = "github" }
[dependencies]
lettre = "0.9"
diff --git a/core/src/lib.rs b/core/src/lib.rs
index c3f7b6ad..3f85413a 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -1,18 +1,18 @@
-// check_if_email_exists
+// check-if-email-exists
// Copyright (C) 2018-2019 Amaury Martiny
-// check_if_email_exists is free software: you can redistribute it and/or modify
+// check-if-email-exists is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// check_if_email_exists is distributed in the hope that it will be useful,
+// check-if-email-exists is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with check_if_email_exists. If not, see <http://www.gnu.org/licenses/>.
+// along with check-if-email-exists. If not, see <http://www.gnu.org/licenses/>.
extern crate lettre;
#[macro_use]
diff --git a/core/src/mx.rs b/core/src/mx.rs
index 884f9b9b..c3432f52 100644
--- a/core/src/mx.rs
+++ b/core/src/mx.rs
@@ -1,18 +1,18 @@
-// check_if_email_exists
+// check-if-email-exists
// Copyright (C) 2018-2019 Amaury Martiny
-// check_if_email_exists is free software: you can redistribute it and/or modify
+// check-if-email-exists is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// check_if_email_exists is distributed in the hope that it will be useful,
+// check-if-email-exists is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with check_if_email_exists. If not, see <http://www.gnu.org/licenses/>.
+// along with check-if-email-exists. If not, see <http://www.gnu.org/licenses/>.
use crate::syntax::SyntaxDetails;
use crate::util::ser_with_display;
diff --git a/core/src/smtp.rs b/core/src/smtp.rs
index 793d3613..7d4693d5 100644
--- a/core/src/smtp.rs
+++ b/core/src/smtp.rs
@@ -1,18 +1,18 @@
-// check_if_email_exists
+// check-if-email-exists
// Copyright (C) 2018-2019 Amaury Martiny
-// check_if_email_exists is free software: you can redistribute it and/or modify
+// check-if-email-exists is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// check_if_email_exists is distributed in the hope that it will be useful,
+// check-if-email-exists is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with check_if_email_exists. If not, see <http://www.gnu.org/licenses/>.
+// along with check-if-email-exists. If not, see <http://www.gnu.org/licenses/>.
use crate::util::ser_with_display;
use lettre::smtp::client::net::NetworkStream;
diff --git a/core/src/syntax.rs b/core/src/syntax.rs
index 736085a6..25079b33 100644
--- a/core/src/syntax.rs
+++ b/core/src/syntax.rs
@@ -1,18 +1,18 @@
-// check_if_email_exists
+// check-if-email-exists
// Copyright (C) 2018-2019 Amaury Martiny
-// check_if_email_exists is free software: you can redistribute it and/or modify
+// check-if-email-exists is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// check_if_email_exists is distributed in the hope that it will be useful,
+// check-if-email-exists is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with check_if_email_exists. If not, see <http://www.gnu.org/licenses/>.
+// along with check-if-email-exists. If not, see <http://www.gnu.org/licenses/>.
use crate::util::ser_with_display;
use lettre::error::Error as LettreError;
diff --git a/core/src/util/mod.rs b/core/src/util/mod.rs
index 1298518c..9503f1ce 100644
--- a/core/src/util/mod.rs
+++ b/core/src/util/mod.rs
@@ -1,18 +1,18 @@
-// check_if_email_exists
+// check-if-email-exists
// Copyright (C) 2018-2019 Amaury Martiny
-// check_if_email_exists is free software: you can redistribute it and/or modify
+// check-if-email-exists is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// check_if_email_exists is distributed in the hope that it will be useful,
+// check-if-email-exists is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with check_if_email_exists. If not, see <http://www.gnu.org/licenses/>.
+// along with check-if-email-exists. If not, see <http://www.gnu.org/licenses/>.
use serde::Serializer;
use std::fmt::Display;
diff --git a/serverless/Cargo.toml b/serverless/Cargo.toml
index 27971bb5..832b2201 100644
--- a/serverless/Cargo.toml
+++ b/serverless/Cargo.toml
@@ -1,13 +1,11 @@
[package]
-name = "check_if_email_exists_serverless"
+name = "check-if-email-exists-serverless"
version = "0.4.0"
-authors = ["Amaury Martiny <[email protected]>"]
-description = "Check if an email address exists without sending any email"
edition = "2018"
publish = false
[dependencies]
-check_if_email_exists_core = { path = "../core" }
+check-if-email-exists = { path = "../core" }
lambda_http = "0.1"
lambda_runtime = "0.2"
serde = { version = "1.0", features = ["derive"] }
diff --git a/serverless/src/main.rs b/serverless/src/main.rs
index 25323d37..8a933fa4 100644
--- a/serverless/src/main.rs
+++ b/serverless/src/main.rs
@@ -1,24 +1,24 @@
-// check_if_email_exists
+// check-if-email-exists
// Copyright (C) 2018-2019 Amaury Martiny
-// check_if_email_exists is free software: you can redistribute it and/or modify
+// check-if-email-exists is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// check_if_email_exists is distributed in the hope that it will be useful,
+// check-if-email-exists is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with check_if_email_exists. If not, see <http://www.gnu.org/licenses/>.
+// along with check-if-email-exists. If not, see <http://www.gnu.org/licenses/>.
extern crate lambda_http;
extern crate lambda_runtime;
extern crate serde_json;
-use check_if_email_exists_core::email_exists;
+use check_if_email_exists::email_exists;
use lambda_http::{lambda, IntoResponse, Request, RequestExt};
use lambda_runtime::{error::HandlerError, Context};
use serde_json::json;
diff --git a/src/main.rs b/src/main.rs
index e373de48..022196da 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,24 +1,24 @@
-// check_if_email_exists
+// check-if-email-exists
// Copyright (C) 2018-2019 Amaury Martiny
-// check_if_email_exists is free software: you can redistribute it and/or modify
+// check-if-email-exists is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// check_if_email_exists is distributed in the hope that it will be useful,
+// check-if-email-exists is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with check_if_email_exists. If not, see <http://www.gnu.org/licenses/>.
+// along with check-if-email-exists. If not, see <http://www.gnu.org/licenses/>.
extern crate clap;
extern crate env_logger;
extern crate serde;
-use check_if_email_exists_core::email_exists;
+use check_if_email_exists::email_exists;
use clap::App;
use serde_json;
diff --git a/test_suite/Cargo.toml b/test_suite/Cargo.toml
index 16e4e090..515e8302 100644
--- a/test_suite/Cargo.toml
+++ b/test_suite/Cargo.toml
@@ -1,12 +1,10 @@
[package]
-name = "check_if_email_exists_test_suite"
+name = "check-if-email-exists-test-suite"
version = "0.4.0"
-authors = ["Amaury Martiny <[email protected]>"]
-description = "Check if an email address exists without sending any email"
edition = "2018"
publish = false
[dependencies]
-check_if_email_exists_core = { path = "../core" }
+check-if-email-exists = { path = "../core" }
serde = "1.0"
serde_json = "1.0"
diff --git a/test_suite/src/lib.rs b/test_suite/src/lib.rs
index 93e0b999..de916816 100644
--- a/test_suite/src/lib.rs
+++ b/test_suite/src/lib.rs
@@ -1,24 +1,24 @@
-// check_if_email_exists
+// check-if-email-exists
// Copyright (C) 2018-2019 Amaury Martiny
-// check_if_email_exists is free software: you can redistribute it and/or modify
+// check-if-email-exists is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-// check_if_email_exists is distributed in the hope that it will be useful,
+// check-if-email-exists is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
-// along with check_if_email_exists. If not, see <http://www.gnu.org/licenses/>.
+// along with check-if-email-exists. If not, see <http://www.gnu.org/licenses/>.
/// E2E tests
#[cfg(test)]
mod tests {
- use check_if_email_exists_core::email_exists;
+ use check_if_email_exists::email_exists;
#[test]
fn should_output_error_for_invalid_email() {