Short of sending an E-Mail and seeing if it bounces there is very little to do to see if an E-Mail address is correct or not.
There are a few obvious things to look for.
1) No spaces in the name
2) One @ and only one @
3) The e-mail addess can not start or end with either a period "." or an "@"
Looking for the @ can be tricky because the @ is the wildcard character in 4D.
Below is a short code example of quickly testing for the most obvious errors in an E-Mail address errors. It returns True for a possible good address and False for a bad one.
Cut and Paste the following code example into your
own 4D project
` Method: MAIL_fValidAddr(EMail) -> Boolean
` 4D Partner Referal WEB Database
` Created By: Kent D. Wilbur
` Date: 12/21/99
` Purpose: Checks to see if E-Mail address entered is valid.
` $1= E-Mail Address
` Variables for Insider
` Define parameters
` Define local varaibles
` Reassign for readability
$0:=False ` Assume the address is bad
$LPosition:=Position(" ";$tEMailAddr) ` Look for a space
If ($LPosition=0) ` None found
If (($tEMailAddr[]=".") | (Ascii($tEMailAddr[])=At sign ) | ($tEMailAddr[[$LLength]]=".") | (Ascii($tEMailAddr[[$LLength]])=At sign )) ` First & Last should not be "." or "@"
` Reject the address
For ($i;2;$LLength-1) ` First and last already checked
If (Ascii($tEMailAddr[[$i]])=At sign ) `Is this an @
$0:=False ` Only one @
$i:=$LLength ` Second @ found don't look any more
$0:=True ` Set true for the first @
`End of method.