Here is what is being used now:
function EmailField(fTestString)
' checks for a vaild email
' returns 0 for invalid addresses
' returns -1 for valid addresses
dim atCnt
EmailField = -1
' chk length
' a@b.c should be the shortest an
' address could be
if len(fTestString) < 5 then
EmailField = 0
' chk format
' has at least one "@"
elseif instr(fTestString,"@") = 0 then
EmailField = 0
' has at least one "."
elseif instr(fTestString,".") = 0 then
EmailField = 0
' has no more than 6 chars after last "."
elseif len(fTestString) - instrrev(fTestString,".") > 6 then
EmailField = 0
' has no "_" after the "@"
elseif instr(fTestString,"_") <> 0 and instrrev(fTestString,"_") > instrrev(fTestString,"@") then
EmailField = 0
' has only one "@"
else
atCnt = 0
for i = 1 to len(fTestString)
if mid(fTestString,i,1) = "@" then
atCnt = atCnt + 1
end if
next
if atCnt > 1 then
EmailField = 0
end if
' chk each char for validity
for i = 1 to len(fTestString)
if not isnumeric(mid(fTestString,i,1)) and _
(lcase(mid(fTestString,i,1)) < "a" or _
lcase(mid(fTestString,i,1)) > "z") and _
mid(fTestString,i,1) <> "_" and _
mid(fTestString,i,1) <> "." and _
mid(fTestString,i,1) <> "@" and _
mid(fTestString,i,1) <> "-" then
EmailField = 0
end if
next
end if
end function