Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.
Rust emailemail-validationemail-validation-apiemail-verificationemail-verification-apiemail-verifierhacktoberfest
Add scripts
Amaury Martinydff6c369385f
diff --git a/README.md b/README.mdindex 646d1c81..ab012eef 100644--- a/README.md+++ b/README.md@@ -1,2 +1,25 @@# check-if-email-existsCheck if an email address exists without sending any email. Uses telnet.++## Why?++Many online services (https://hunter.io, http://verify-email.org, http://email-checker.net) offer this service for a fee. Here is an open-source alternative to those tools.++## Usage++```bash+chmod a+x checkEmail.sh+./checkEmail.sh [email protected]+```++Outputs true if email exists, false if it doesn't.++## Notes++This is really a draft version of the tool, for my personal uses. If someone wants to improve it (and it's easy), please submit a PR.++The main Bash script (checkEmail.sh) calls a expect script (expectTelnet.sh) to make a Telnet call to the host with ports 587, 465 and 25.++## License++See the LICENSE file.\ No newline at end of filediff --git a/checkEmail.sh b/checkEmail.shnew file mode 100755index 00000000..78fa2499--- /dev/null+++ b/checkEmail.sh@@ -0,0 +1,23 @@+#! /bin/bash++# Set useful variables+EMAIL="$1";+HOST=`cut -d "@" -f 2 <<< "$1"`;+PORTS=(587 25 465); # The PORTS to test our telnet on, in this order++for PORT in ${PORTS[@]}+do+ OUTPUT=`expect expectTelnet.sh $EMAIL $HOST $PORT`;+ if [[ `echo $OUTPUT | grep "2.1.5"` ]]; # 2.1.5 means address exists+ then+ echo true;+ exit 0;+ elif [[ `echo $OUTPUT | grep "5."` ]]; # 5.*.* are error codes+ then+ echo false;+ exit 1+ fi+done++echo false;+exit 1;diff --git a/expectTelnet.sh b/expectTelnet.shnew file mode 100644index 00000000..7b12c985--- /dev/null+++ b/expectTelnet.sh@@ -0,0 +1,16 @@+#! /usr/bin/env expect++# Retrive arguments+set email [lindex $argv 0]+set host [lindex $argv 1]+set port [lindex $argv 2]++# Start a Telnet communication+spawn telnet $host $port;+expect "220"+send "MAIL FROM: [email protected]\r";+expect "250"+send "RCPT TO: $email\r";+expect "*"+send "QUIT\r"+expect eof