Palabras clave: correo, mail, verificar
Autor: Rubén Vigón
Extraído de: La web del Búho
Objetivo
Para comprobar que una dirección MAIL es válida.
Public Function IsEmail(ByVal strEmail As String) As Boolean
Dim strTemp As String
If Not InStr(strEmail, "@") > 0 Then
IsEmail = False
Else
If Not InStr(strEmail, ".") > 0 Then
IsEmail = False
Else
If Not Len(Left(strEmail, InStr(strEmail, "@") - 1)) >= 3 Then
IsEmail = False
Else
strTemp = Mid(strEmail, InStr(strEmail, "@") + 1, Len(strEmail))
If Not Len(Left(strTemp, InStr(strTemp, ".") - 1)) >= 3 Then
IsEmail = False
Else
If Not Len(Right(strTemp, Len(strTemp) - InStr(strTemp, "."))) >= 2 Then
IsEmail = False
Else
IsEmail = True
End If
End If
End If
End If
End If
End Function