1#!/bin/sh 2# ValidatePeopleEmails 3# Goes through all your People files and checks that the e-mail addresses 4# are valid. Useful for bulk e-mailing where one bad address will make 5# the SMTP mail server reject the whole lot. 6# By mmu_man, September 18 2003, inspired by Dane's request, used with 7# permission in MDR. 8 9query -a 'META:email==*' | xargs catattr META:email >/tmp/PeopleListTemp 10 11cat /tmp/PeopleListTemp | while read LINE; do 12 NULLATTR="${LINE#* : string :}" 13 if [ "x$NULLATTR" = "x" ]; then 14 echo "WARNING: no email address in $LINE" 15 continue 16 fi 17 PPLFILE="${LINE% : string : *}" 18 PPL="${PPLFILE##*/}" 19 THEMAIL="${LINE##* : string : }" 20 FILTERED="$(echo "$THEMAIL" | sed 's/[A-Za-z0-9.+_-]*\@[A-Za-z0-9._-]*/GOOD/' )" 21 echo "[$PPL] [$THEMAIL] $FILTERED" 22 if [ "x$FILTERED" != "xGOOD" ]; then 23 echo "WARNING: strange email for '$PPL': <$THEMAIL>" 24 fi 25done 26 27sed 's/ $/<--Blanks at the end of the e-mail, BAD!/' </tmp/PeopleListTemp >/tmp/PeopleListOut 28sed 's/: string :<--Blanks at the end/No e-mail/' </tmp/PeopleListOut >/tmp/PeopleListBlanked 29grep "Blanks at the end" /tmp/PeopleListBlanked 30