Sign in to follow this  
Followers 0
bobheart

All Valid ?

14 posts in this topic

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

Share this post


Link to post
Share on other sites



Anyone ?

Share this post


Link to post
Share on other sites

hehehe i tried to used autoit to delete files by a certain size. i ended up deleteing my whole harddrive by accident. are you sure you want my help? :ph34r:


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

hahahaha sure what the hell .. :ph34r:

Share this post


Link to post
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.

 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
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


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

i relocated your valid check, to the bottom. :ph34r:


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Glad i could help, without melting down autoit. :ph34r:


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

Still says any email address is valid . try

@nothing.com

Share this post


Link to post
Share on other sites

see the person who wrote this, forgot to put a nothing checker, if nothing is there, at the beginning of the @ then it should be invalid. if stringlen=0 then invalid. or something...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

I was wondered about that too . I tried to add something but just buggered it up . lol

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

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

 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

: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...

Share this post


Link to post
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
Sign in to follow this  
Followers 0