ASP Function to verify if an address mail is valid
Techniques
This section makes it possible to gather a whole of techniques or scripts which have the originality to manage to solve a difficulty with the least effort or which are particularly effective...The grayed entries relate to the future headings which will supplement soon this toolbox.
Techniques / Verify if an address mail is valid
- Script: verify if an address mail is valid :
Before the sending of a mail to avoid a useless excess load on IIS, it is possible to use a simple function to verify that the email address is well formed. In a more pushed process we could be also brought to interrogate the smtp corresponding server to know if the address exists or not.
<% function IsValid(email) IsValid = true dim names, name, i, c names = Split(email, "@") if UBound(names) <> 1 then IsValid = false exit function end if for each name in names if Len(name) <= 0 then IsValid = false exit function end if for i = 1 to Len(name) c = Lcase(Mid(name, i, 1)) letters="abcdefghijklmnopqrstuvwxyz_-." if InStr(letters, c) <= 0 and not IsNumeric(c) then IsValid = false exit function end if next if Left(name, 1) = "." or Right(name, 1) = "." then IsValid = false exit function end if next if InStr(names(1), ".") <= 0 then IsValid = false exit function end if i = Len(names(1)) - InStrRev(names(1), ".") if i <> 2 and i <> 3 then IsValid = false exit function end if if InStr(email, "..") > 0 then IsValid = false end if end function %>