Jump to content

All Valid ?


Recommended Posts

I tried to do this and it says all the emails are all valid . lol

$X = InputBox("Question", "email address to check?", "emailaddress@what.com", "", -1, -1, 0, 0)

If IsValidSmtpAddress($X) Then 

  MsgBox(0, "Testing", "Valid E-Mail address")

Else

  MsgBox(0, "Testing", "Not Valid")

EndIf

Func IsValidSmtpAddress($ADDRESS)

  Dim $I, $M

  Dim $NPOS, $NDPOS

 

  ;Valid format:  alpha.numeric02@whereever.com

  $NPOS = StringInStr($ADDRESS, "@")

  If $NPOS = 0 Then Return 0;False

  For $I = 1 To $NPOS - 1

      $M = StringMid($ADDRESS, $I, 1)

      Select

        Case StringIsAlNum($M);Alphanumeric - valid

          ; Do nothing

        Case StringInStr(".%_-", $M) > 0

          ; Do nothing

        Case Else 

            Return 0;False

      EndSelect

  Next

 

  ; Valid name, now for the domain.

  ; Find the .com, .net, etc.

  $NDPOS = StringInStr($ADDRESS, ".", 0, -1)

  if ($NDPOS < $NPOS) Then Return 0;False

  ;scan all characters

  For $I = $NPOS + 1 To StringLen($ADDRESS)

      $M = StringMid($ADDRESS, $I, 1)

      Select

        Case StringIsAlNum($M) ;Alphanumeric - valid

          ; Do nothing

        Case StringInStr(".%_-", $M) > 0

          ; Do nothing

        Case Else 

            Return 0;False

      EndSelect

  Next

  Return 1;True

EndFunc  ;==>IsValidSmtpAddress

Link to comment
Share on other sites

:ph34r: Living Dangerously. :( ok i will try to help. let me reload autoit, and no it isn't from deleting my entire harddrive. lol had to reinstall windows because i got my own web site, and i need to learn php and other goodies as such. brb give me a sec.
Link to comment
Share on other sites

rflmao

i found your problem

$X = InputBox("Question", "email address to check?", "emailaddress@what.com", "", -1, -1, 0, 0)


Func IsValidSmtpAddress($ADDRESS)
  Dim $I, $M
  Dim $NPOS, $NDPOS
 
 ;Valid format:  alpha.numeric02@whereever.com
  $NPOS = StringInStr($ADDRESS, "@")
  If $NPOS = 0 Then Return 0;False
  For $I = 1 To $NPOS - 1
      $M = StringMid($ADDRESS, $I, 1)
      Select
        Case StringIsAlNum($M);Alphanumeric - valid
         ; Do nothing
        Case StringInStr(".%_-", $M) > 0
         ; Do nothing
        Case Else 
            Return 0;False
      EndSelect
  Next
 
 ; Valid name, now for the domain.
 ; Find the .com, .net, etc.
  $NDPOS = StringInStr($ADDRESS, ".", 0, -1)
  if ($NDPOS < $NPOS) Then Return 0;False
 ;scan all characters
  For $I = $NPOS + 1 To StringLen($ADDRESS)
      $M = StringMid($ADDRESS, $I, 1)
      Select
        Case StringIsAlNum($M);Alphanumeric - valid
         ; Do nothing
        Case StringInStr(".%_-", $M) > 0
         ; Do nothing
        Case Else 
            Return 0;False
      EndSelect
  Next
  Return 1;True
EndFunc ;==>IsValidSmtpAddress


If IsValidSmtpAddress($X) Then 
  MsgBox(0, "Testing", "Valid E-Mail address")
Else
  MsgBox(0, "Testing", "Not Valid")
EndIf

try that.. lol

Link to comment
Share on other sites

Well I got the code from the v3 Scripts and Scraps froum that someone made but I soon saw that it didn't work .

But thank you all give that a try . '

/me backs my drive before running code . heh heh

Link to comment
Share on other sites

lol try this also.

@.

it is a valid email address. bob you can write a better than this. @. is all it looks for you know as well as i do it has to find everything.... scrap this script (suggested), and build a new one.

Edited by beerman
Link to comment
Share on other sites

:ph34r: I did say that it was untested on the Scripts and Scraps forum when I wrote it. I will fix the version here to check for empty sections.

Edit: Done.

Edited by Nutster

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...