Jump to content

Verify email adress?


 Share

Recommended Posts

Hi all,

i am looking fo an easy way to verify that an email adress (entered by the user) is (as) correct (as possible).

Things like

- is there an @ at a location that is valid

- is there an . at a location that is valid

- is the top level domain (.com/.net/...) valid (maybe better not as new top level domains come up)

- maybe check if the mx server for an email adress exists

does anyone have an UDF/Functin for this? Thanks!

Link to comment
Share on other sites

  • Moderators

Allow2010,

This RegExp information should help you make sure that the format is correct. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks for the idea, but this will probaly cause more trouble than it can prevent:

Another trade-off is that my regex only allows English letters

is one of the problems and also some top level domains are not covered...

better would be a real verification of the email (by contacting the server)....is this possible?

Edited by Allow2010
Link to comment
Share on other sites

  • 1 year later...

I have the same question, and seek an answer. I ran into this article that may shed some light upon what I want to achieve. See the quote here under. Can this be done in AI? And how? 

 

http://www.ip-tracker.org/checker/email-lookup.php

Email Checker: Lookup and Check Email With Email Checker

Email lookup also known as Email checker is very fast, free and accurate Email tool which provide live verification process of emails using next steps:

I.        First, Email lookup resolve host name (SMTP server) to IP address from Email that you are checking and then try to connect to that SMTP server via port 25. 
For example whatever@hotmail.com point to Email SMTP server mx4.hotmail.com with IP address 65.55.37.120. If connection is successful then our Email checker tool start to verify Email using Email Verifier process

II.        Email verifier process is the process of verifying email by sending SMTP HELLO command to other side (SMTP server) asking to verify email address. 
Once SMTP server accept our request and our "question" then he let us know of Mail ID / Recipient is OK or NOT.

III.        Final step of our email lookup process is to let you show answer from SMTP server: "the host states that the address is valid or not." 
Once we get answer we disconnect from SMTP server.

 

/Lars

Denmark

www.lpmathiasen.com

Automation and simplification is my game!

Link to comment
Share on other sites

  • 2 years later...

Simple way to check, just loop through and check each char, if you find a "@" then look for a "." if you find that, you're good to go.

Here's a very simple example.

 

#include <MsgBoxConstants.au3>

Global $i = 0

Global $str=String("blahblah@test.com")


For $i = $i To StringLen($str)-1
   If StringMid($str, $i, 1) == '@' Then
      ExitLoop
   EndIf
Next

For $i = $i To StringLen($str) -1
   If StringMid($str, $i, 1) == '.' Then
      MsgBox(0, "Success", "Email address is valid")
   EndIf
Next

 

Link to comment
Share on other sites

4 hours ago, msd1994 said:

Simple way to check, just loop through and check each char, if you find a "@" then look for a "." if you find that, you're good to go.

Here's a very simple example.

 

#include <MsgBoxConstants.au3>

Global $i = 0

Global $str=String("blahblah@test.com")


For $i = $i To StringLen($str)-1
   If StringMid($str, $i, 1) == '@' Then
      ExitLoop
   EndIf
Next

For $i = $i To StringLen($str) -1
   If StringMid($str, $i, 1) == '.' Then
      MsgBox(0, "Success", "Email address is valid")
   EndIf
Next

 

msd1994,

Not to step on your toes but you method is not the best because if you input "blahblah@.com" it will tell is a valid E-mail address when we all know that's not true. I recommend checking my app and code because they use two different methods the first is a local format check and then if it's a valid format will pass to second check which is an online check to verify E-mail's legitimacy..  Internet connection is required to pass to second verification and my app will check internet connectivity beforehand. I must say that credits to my app aren't all mine check my comments in my code to find out more. 

Edited by Mannyfresh15
Typo
Link to comment
Share on other sites

21 hours ago, Mannyfresh15 said:

msd1994,

Not to step on your toes but you method is not the best because if you input "blahblah@.com" it will tell is a valid E-mail address when we all know that's not true. I recommend checking my app and code because they use two different methods the first is a local format check and then if it's a valid format will pass to second check which is an online check to verify E-mail's legitimacy..  Internet connection is required to pass to second verification and my app will check internet connectivity beforehand. I must say that credits to my app aren't all mine check my comments in my code to find out more. 

he could add a check for something that's neither "@" nor "." in between, but this is just the simplest way I thought to do without regex. Your app would most likely be a more foolproof method ,assuming it was made specifically to check if an email address is valid, if he chose to use it, I haven't personally looked at it

Link to comment
Share on other sites

Link to comment
Share on other sites

2 hours ago, spudw2k said:

It might be best to establish what the rules are and make sure they are all accounted for.  
https://en.wikipedia.org/wiki/Email_address#Local_part
https://en.wikipedia.org/wiki/Email_address#Domain_part

Definitely accomplish-able with RegEx...but that's beyond my skill-set (capture groups, back references....ugh)

I wouldn't change the settings of the function in my code as most if not all of the major E-mail providers will flag other kind of formats as invalid format so I just gonna stick with my method. Check the Images below.

 

Invalid_Format.png

 

Invalid_Format_2.png

If images not showing go to: http://imgur.com/a/9OQw7

This is an example of a valid E-mail address 

Valid_Format.png

Edited by Mannyfresh15
IMG not showing
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...