Mi sitio InicioRegistrarseEntrada
Inicio » 2012 » Noviembre » 30 » Validar mail visual .net
9:34 PM
Validar mail visual .net
 Public Function Validar_Email(ByVal Email As String) As Boolean
        Dim i As Integer, iLen As Integer, caracter As String
        Dim pos As Integer, bp As Boolean, iPos As Integer, iPos2 As Integer

        On Error GoTo ErrorValidar_Email

        Email = Trim$(Email)

        If Email = vbNullString Then
            Exit Function
        End If

        Email = LCase$(Email)
        iLen = Len(Email)


        For i = 1 To iLen
            caracter = Mid(Email, i, 1)

            If (Not (caracter Like "[a-z]")) And (Not (caracter Like "[0-9]")) Then

                If InStr(1, "_-" & "." & "@", caracter) > 0 Then
                    If bp = True Then
                        Exit Function
                    Else
                        bp = True

                        If i = 1 Or i = iLen Then
                            Exit Function
                        End If

                        If caracter = "@" Then
                            If iPos = 0 Then
                                iPos = i
                            Else

                                Exit Function
                            End If
                        End If
                        If caracter = "." Then
                            iPos2 = i
                        End If

                    End If
                Else

                    Exit Function
                End If
            Else
                bp = False
            End If
        Next i
        If iPos = 0 Or iPos2 = 0 Then
            Exit Function
        End If

        If iPos2 < iPos Then
            Exit Function
        End If
        Validar_Email = True

        Exit Function

ErrorValidar_Email:
        Validar_Email = False
    End Function
Vistas: 483 | Agregado por: miket | Valoración: 0.0/0
Total de comentarios: 0
Solamente los usuarios registrados pueden agregar comentarios.
[ Registrarse | Entrada ]
Domingo, 05.19.2024, 1:15 AM
Menú del sitio
Formulario de entrada
Búsqueda
Archivo de registros
Estadística

Total en línea: 1
Invitados: 1
Usuarios: 0
Calendario
«  Noviembre 2012  »
LuMaMiJuViSaDo
   1234
567891011
12131415161718
19202122232425
2627282930
 






Copyright nientiendo © 2024 Miguel A. Vallejo Duran