Custom Search

Friday, October 3, 2008

How to write an email address validation script in TSL?

public function IsValidEMAIL(in strText)
{
auto aryEmail[], aryEmail2[], n;


n = split(strText, aryEmail, "@");
if (n != 2)
return FALSE;

# Ensure the string "@MyISP.Com" does not pass...
if (!length(aryEmail[1]))
return FALSE;

n = split(aryEmail[2], aryEmail2, ".");
if (n < 2)
return FALSE;
# Ensure the string "Recipient@." does not pass...
if (!(length(aryEmai2[1]) * length(aryEmai2[1])))
return FALSE;

return TRUE;
}

No comments: