head	1.2;
access;
symbols
	release-2-3-0-final:1.2
	release-2-2-6-final:1.2
	release-2-2-5-final:1.2
	release-2-2-4-final:1.2
	release-2-2-3-final:1.2;
locks; strict;
comment	@# @;


1.2
date	2003.09.18.23.33.59;	author agmsmith;	state Exp;
branches;
next	1.1;

1.1
date	2003.09.18.19.06.16;	author agmsmith;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Also report empty e-mails and ones with blanks at the end.
@
text
@#!/bin/sh
# ValidatePeopleEmails
# Goes through all your People files and checks that the e-mail addresses
# are valid.  Useful for bulk e-mailing where one bad address will make
# the SMTP mail server reject the whole lot.
# By mmu_man, September 18 2003, inspired by Dane's request, used with
# permission in MDR.

query -a 'META:email==*' | xargs catattr META:email >/tmp/PeopleListTemp

cat /tmp/PeopleListTemp | while read LINE; do
	NULLATTR="${LINE#* : string :}"
	if [ "x$NULLATTR" = "x" ]; then
		echo "WARNING: no email address in $LINE"
		continue
	fi
	PPLFILE="${LINE% : string : *}"
	PPL="${PPLFILE##*/}"
	THEMAIL="${LINE##* : string : }"
	FILTERED="$(echo "$THEMAIL" | sed 's/[A-Za-z0-9.+_-]*\@@[A-Za-z0-9._-]*/GOOD/' )"
	echo "[$PPL] [$THEMAIL] $FILTERED"
	if [ "x$FILTERED" != "xGOOD" ]; then
		echo "WARNING: strange email for '$PPL': <$THEMAIL>"
	fi
done

sed 's/ $/<--Blanks at the end of the e-mail, BAD!/' </tmp/PeopleListTemp >/tmp/PeopleListOut
sed 's/: string :<--Blanks at the end/No e-mail/' </tmp/PeopleListOut >/tmp/PeopleListBlanked
grep "Blanks at the end" /tmp/PeopleListBlanked
@


1.1
log
@A bash shell utility for validating People file e-mail addresses.
@
text
@d9 3
a11 1
query -a 'META:email==*' | xargs catattr META:email | while read LINE; do
d14 1
d19 1
a19 1
	THEMAIL="${LINE#* : string : }"
d26 4
@

