Allow2010 Posted December 31, 2011 Share Posted December 31, 2011 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 More sharing options...
Moderators Melba23 Posted December 31, 2011 Moderators Share Posted December 31, 2011 Allow2010,This RegExp information should help you make sure that the format is correct. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Allow2010 Posted December 31, 2011 Author Share Posted December 31, 2011 (edited) 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 December 31, 2011 by Allow2010 Link to comment Share on other sites More sharing options...
lpm Posted June 20, 2013 Share Posted June 20, 2013 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 More sharing options...
Mannyfresh15 Posted June 19, 2016 Share Posted June 19, 2016 (edited) .... Edited July 15, 2016 by Mannyfresh15 Link to comment Share on other sites More sharing options...
msd1994 Posted June 20, 2016 Share Posted June 20, 2016 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 More sharing options...
Mannyfresh15 Posted June 20, 2016 Share Posted June 20, 2016 (edited) 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 June 20, 2016 by Mannyfresh15 Typo Link to comment Share on other sites More sharing options...
msd1994 Posted June 21, 2016 Share Posted June 21, 2016 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 Mannyfresh15 1 Link to comment Share on other sites More sharing options...
Mannyfresh15 Posted June 21, 2016 Share Posted June 21, 2016 (edited) I see your point and yes you're right a person could just add a check in between @ and . Whoever, I think your example is clearer now Edited June 21, 2016 by Mannyfresh15 Link to comment Share on other sites More sharing options...
spudw2k Posted June 21, 2016 Share Posted June 21, 2016 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_parthttps://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) Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Mannyfresh15 Posted June 21, 2016 Share Posted June 21, 2016 (edited) 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_parthttps://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. If images not showing go to: http://imgur.com/a/9OQw7 This is an example of a valid E-mail address Edited June 21, 2016 by Mannyfresh15 IMG not showing Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now