VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Validate Email ID (updated) This function validates the emailID string and returns a boolean value

by Ganesh Thambiran (2 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 26th February 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Validate Email ID (updated) This function validates the emailID string and returns a boolean value

API Declarations


if ValidateEmail("[email protected]") then
'valid id
else
'invalid id
end if



Rate Validate Email ID (updated) This function validates the emailID string and returns a boolean value



  Dim m, n, o, i
  If InStr(sEmail, "@") > 0 Then
    For i = 1 To Len(sEmail)
      If InStr("[email protected]_", lcase(Mid(sEmail, i, 1))) > 0 Then
      Else
        ValidateEmail = False
        Exit Function
      End If
    Next
    m = Split(sEmail, "@")
    If UBound(m) > 1 Then
      ValidateEmail = False
      Exit Function
    End If
    o = Split(m(0), ".")
    For i = 0 To UBound(o) ' - 1
      If Len(o(i)) < 1 Then
        ValidateEmail = False
        Exit Function
      End If
    Next
    For i = 0 To UBound(m) - 1
      If Len(m(i)) < 2 Then
        ValidateEmail = False
        Exit Function
      End If
    Next
    If InStr(m(1), ".") > 0 Then
      n = Split(m(1), ".")
      For i = 0 To UBound(n) ' - 1
        If Len(n(i)) < 2 Then
          ValidateEmail = False
          Exit Function
        End If
      Next
    Else
      ValidateEmail = False
      Exit Function
    End If
  Else
    ValidateEmail = False
    Exit Function
  End If
  ValidateEmail = True
end function


Download this snippet    Add to My Saved Code

Validate Email ID (updated) This function validates the emailID string and returns a boolean value Comments

No comments have been posted about Validate Email ID (updated) This function validates the emailID string and returns a boolean value. Why not be the first to post a comment about Validate Email ID (updated) This function validates the emailID string and returns a boolean value.

Post your comment

Subject:
Message:
0/1000 characters