<%
Option Explicit
Dim LocalTest
LocalTest = "mary@somewhere.com"
Response.Write ValidateEmailAddress(LocalTest)
%>
<% 
Function ValidateEmailAddress(FieldToTest)
Dim TheAt
Dim TheDot
If Len(FieldToTest) < 6 then
  ValidateEmailAddress = "Adres e-mail jest nieprawidowy!"
Else
  TheAt = InStr(2, FieldToTest, "@")
  If TheAt = 0 Then
    ValidateEmailAddress = "Adres e-mail jest nieprawidowy!"
  Else
    TheDot = InStr(cint(TheAt) + 2, FieldToTest, ".")
    If TheDot = 0 Then
      ValidateEmailAddress = "Adres e-mail jest nieprawidowy!"
    ElseIf cint(TheDot) + 1 > Len(FieldToTest) Then
      ValidateEmailAddress = "Adres e-mail jest nieprawidowy!"
    Else
      ValidateEmailAddress = "Adres e-mail jest prawidowy!"
    End If
  End If
End If
End Function
%>
