Convalidare indirizzo email

<%
'##################################
'#Come convalidare un indirizzo
'#E-Mail
'##################################

Function MailCorretta(strMail)

  If Len(strMail) > 6 Then

      pos = Instr(1, strMail, "@")
      If pos >= Len(strMail) - 3 Then
          Exit Function
      End If
  
      If pos < 2 Then
          Exit Function
      End If
    
      dotpos = Instr(pos + 1, strMail, ".")
      If dotpos > Len(strMail) - 2 Then
          Exit Function
      End If      
  
      If Len(Mid(strMail, pos + 1)) < 5 Or dotpos = 0 Then
          Exit Function
      End If  
    
      MailCorretta = True
    
  Else
  
      MailCorretta = False
      
  End If

End Function

strMail = "webmaster@byluciani.com"

If MailCorretta(strMail) Then

    Response.Write strMail & " è una E-Mail valida"

Else

    Response.Write strMail & " NON è una E-Mail valida"

End If
%>

 

Ti potrebbe interessare anche

commenta la notizia

C'è 1 commento
Sara
Hai dubbi su questo articolo?