--- ../2004-03-01-17/chkmadd 2004-03-01 16:47:24.000000000 +0100 +++ chkmadd 2004-03-29 20:04:14.000000000 +0200 @@ -1,13 +1,13 @@ - #!/bin/sh - appname=`basename "$0" 2>/dev/null || echo "$0"` - ver='0.1.2.2004030117' + #!/bin/bash + appname=${0##*/} + ver='0.1.2.2004032801' copy='2003, 2004' mail='mehl@PointedEars.de' mail_feedback='chkmadd@PointedEars.de' latest_uri='http://PointedEars.de.vu/tools/network/chkmadd/' # ---------------------------------------------------------------------------- # chkmadd 0.1.2 -- E-Mail Address Checker - # Copyright (C) 2003, 2004 Thomas Lahn + # Copyright (C) 2003, 2004 Thomas Lahn # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -387,8 +387,21 @@ do echo "Verifying <$i> ..." + if [ -z "${i%%@*}" ]; then + echo 'The local-part is missing, thus <'$i'> + is definitely not a (valid) e-mail address.' | $fmt >&2 + exit_code=$E_ADDRESS_DOESNT_EXIST + continue + fi + # pass domain part of e-mail address to `host' domain=${i##*@} + if [ -z "$domain" ]; then + echo 'The domain-part is missing, thus <'$i'> + is definitely not a (valid) e-mail address.' | $fmt >&2 + exit_code=$E_ADDRESS_DOESNT_EXIST + continue + fi while true do @@ -425,16 +438,17 @@ do test -z "`echo "${domain}" | grep '^.\+\..\+$'`" && break done - mxs=`echo "${mx_query}" | grep 'mail'` + mxs=`echo "${mx_query}" | grep ' mail '` if [ -z "${mxs}" ]; then - echo 'None, thus <'$i'> is no (valid) e-mail address.' + echo 'None, thus <'$i'> + is definitely not a (valid) e-mail address.' | $fmt >&2 exit_code=$E_ADDRESS_DOESNT_EXIST continue fi echo "${mxs}" - hosts= + unset hosts for j in ${mxs} do hosts[${#hosts[@]}]=`echo $j | @@ -455,11 +469,21 @@ do ${_exp} ${_exp_script} "${hosts[$j]}" "$i" fi exit_code=$? - test $exit_code -eq 0 && break + if [ $exit_code -eq 0 ]; then + echo ' + <'$i'> + is apparently an e-mail address.' | $fmt >&2 + break + fi else telnet -- "${hosts[$j]}" smtp fi done + if [ $use_expect -eq 1 ] && [ $exit_code -ne 0 ]; then + echo ' + <'$i'> + is apparently not an e-mail address.' | $fmt >&2 + fi done IFS=${IFS_BAK}