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 support of optional custom sender mail address
h@di884984f49d68
diff --git a/README.md b/README.mdindex ccc5196c..f87819a5 100644--- a/README.md+++ b/README.md@@ -16,6 +16,21 @@ Make sure you have Telnet installed.Outputs `true` if email exists, `false` if it doesn't.+Some mail providers validate sender's mail address before respond, so you should give a valid mail address as sender's mail.++You can do this by one of the following methods:++```bash+export [email protected]+./checkEmail.sh [email protected]+```++or++```bash+./checkEmail.sh [email protected] [email protected]+```+## NotesThis 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 code is really easy, but needs some improvement to be deliverable to the public.diff --git a/checkEmail.sh b/checkEmail.shindex c9e40514..df732781 100755--- a/checkEmail.sh+++ b/checkEmail.sh@@ -6,9 +6,16 @@ DOMAIN=`cut -d "@" -f 2 <<< "$1"`;MX_HOSTS=(`nslookup -q=mx $DOMAIN | grep mail | cut -d " " -f 5`) # Find MX hosts of our domainPORTS=(25 587 465); # The PORTS to test our telnet on, in this order+if [[ $# == 2 ]]; then+ SENDER="$2"+fi+if [ -z $SENDER ]; then+ SENDER='[email protected]'+fi+for HOST in ${MX_HOSTS[@]}; dofor PORT in ${PORTS[@]}; do- OUTPUT=`expect expectTelnet.tcl $EMAIL $HOST $PORT`;+ OUTPUT=`expect expectTelnet.tcl $EMAIL $HOST $PORT $SENDER`;if [[ `echo $OUTPUT | grep "2.1.5"` ]]; then # 2.1.5 means address existsecho true;exit 0;diff --git a/expectTelnet.tcl b/expectTelnet.tclindex d52525a3..5afa2232 100644--- a/expectTelnet.tcl+++ b/expectTelnet.tcl@@ -4,13 +4,14 @@set email [lindex $argv 0]set host [lindex $argv 1]set port [lindex $argv 2]+set sender [lindex $argv 3]# Start a Telnet communicationspawn telnet $host $port;expect "220"send "HELO Hi\r";expect "250"-send "MAIL FROM: <[email protected]>\r";+send "MAIL FROM: <$sender>\r";expect "250"send "RCPT TO: <$email>\r";expect "*"