fiogf49gjkf0d
In this article Thomas Aussem shows how to validate e-mail addresses in SalesLogix using VBScript and Regular Expressions. This article is a great source to get you up to speed on taking advantage of expressions to do data validation in the SalesLogix client.
With storing e-mail addresses in the database and using them for mail merges, you will often find a lot of bounced e-mails from your campaign, because the syntax of the e-mail was not correct.
The purpose of this script is to validate the syntax of an e-mail address to ensure it is a valid e-mail address. You can run this script after entering an e-mail address, e.g. on the OnExitControl event of an Edit control.
To perform the validation check on the e-mail address, this script uses a regular expression, that checks the allowed characters in an e-mail address.
' check the syntax of an email address (TRUE/FALSE)
Function CheckEmailAddress(strEMail)
Dim objRegExp, iMatches, sPattern
' search pattern of valid email address:
' valid characters are: a-z, 0-9, ., -, _
' only one @-sign is allowed; minimum is one dot after @-sign, number of
' characters after last dot is 2 chars, maximimum is 4 chars
sPattern = "^[\w\.\-]+@([\w\-]+\.)*[\w\-]{2,63}\.[a-zA-Z]{2,4}$"
' leave function and return false when parameter is empty
If len(trim(StrEMail)) = 0 Then
CheckEmailAddress = False
Exit Function
End If
' generate new regular expression
Set objRegExp = New RegExp
objRegExp.Pattern = sPattern
objRegExp.IgnoreCase = True
Set iMatches = objRegExp.Execute(strEMail)
If iMatches.Count = 1 Then
CheckEmailAddress = True
Else
CheckEmailAddress = False
End If
Set objRegExp = Nothing
End Function
This script will work with any version of SalesLogix 6.x, since it uses only VBScript and Regular Expression, which are available from any version SalesLogix script.