www.webdigi.co.uk Open in urlscan Pro
2a06:98c1:3121::3  Public Scan

Submitted URL: http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/
Effective URL: https://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/
Submission: On July 24 via manual from US — Scanned from NL

Form analysis 0 forms found in the DOM

Text Content

Web Development


WEB DEVELOPMENT





THOUGHTS FROM LONDON, UK

 * About
 * Apps

January 16, 2009


HOW TO CHECK IF AN EMAIL ADDRESS EXISTS WITHOUT SENDING AN EMAIL?

We have all been doing email address validation for a very long time to make
sure that the email is correctly formatted. This is to avoid users entering
wrongly formatted email address but still they can accidentally give us a wrong
email address.

Example of a correctly formatted email address but still wrong:

mailbox.does.not.exist@webdigiapps.com [VALID format but does not exist]

Above case specifically happens when you take important customer email on phone
and you type in the wrong email. So is there a QUICK solution to really check
the email without sending a test message to the user? Yes.



HOW TO TEST IF THE EMAIL ADDRESS ACTUALLY EXISTS

To check if user entered email mailbox.does.not.exist@webdigiapps.com really
exists go through the following in command prompt on windows / terminal on mac.
The commands you type in are in green and the server response is in blue. Please
refer to MAC & PC screenshots towards the end of this post.

Step 1 – Find mail exchanger or mail server of webdigiapps.com

COMMAND:
nslookup -q=mx webdigiapps.com
RESPONSE:
Non-authoritative answer:
webdigiapps.com mail exchanger = 0 mx2.sub3.homie.mail.dreamhost.com.
webdigiapps.com mail exchanger = 0 mx1.sub3.homie.mail.dreamhost.com.

Step 2 – Now we know the mail server address so let us connect to it. You can
connect to one of the exchanger addresses in the response from Step 1.

COMMAND:
telnet mx2.sub3.homie.mail.dreamhost.com 25
RESPONSE:
Connected to mx2.sub3.homie.mail.dreamhost.com.
Escape character is ‘^]’.
220 homiemail-mx7.g.dreamhost.com ESMTP

COMMAND:
helo hi
RESPONSE:
250 homiemail-mx8.g.dreamhost.com

COMMAND:
mail from: <youremail@gmail.com>
RESPONSE:
250 2.1.0 Ok

COMMAND:
rcpt to: <mailbox.does.not.exist@webdigiapps.com>
RESPONSE:
550 5.1.1 <mailbox.does.not.exist@webdigiapps.com>: Recipient address rejected:
User unknown in virtual alias table

COMMAND:
quit
RESPONSE:
221 2.0.0 Bye


SCREENSHOTS – MAC TERMINAL & WINDOWS





NOTES:

1) the 550 response indicates that the email address is not valid and you have
caught a valid but wrong email address. This code can be on the server and
called on AJAX when user tabs out of the email field.  The entire check will
take less than 2 seconds to run and you can make sure that the email is correct.
2) If email was present the server will respond with a 250 instead of 550
3) There are certain servers with a CATCH ALL email and this means all email
address are accepted as valid on their servers (RARE but some servers do have
this setting).
4) Please do not use this method to continuously to check
for availability of gmail / yahoo / msn accounts etc as this may cause your IP
to be added to a blacklist.
5) This is to supplement the standard email address javascript validation.




113 Comments
 * Share via Email
 * Share on Facebook
 * Share on Twitter
 * Share on Google+


ALSO READ...


 * A SINGLE KILL SWITCH FOR 90% OF THE TOP TEN WEBSITES
   
   1


 * USING A MOBILE DEVICE TO CONTROL A GAME ON YOUR BROWSER
   
   27


 * COOL NEW STUFF IN PHP 5.4
   
   2


 * GOOGLE ANALYTICS FOR FACEBOOK FAN PAGES
   
   408


 * UNDERSTANDING FTP USING RAW FTP COMMANDS AND TELNET
   
   21


COMMENTS


COMMENT NAVIGATION


Older Comments →

 1.  Pingback: alguna funcion php para verificar existencia de un correo? -
     Foros de CHW

     
 2.  severin said on January 18, 2011 at 6:17 pm:
     
     Thanks for this useful trick. Unfortunately it does not work with the
     server I tried. It says:
     554-….
     554 Your access to this mail system has been rejected due to the sending
     MTA’s p
     oor reputation. If you believe that this failure is in error, please
     contact the
     intended recipient via alternate means.
     
     Looks like there’s no workaround?

     
 3.  Amit said on January 19, 2011 at 7:56 pm:
     
     Live demo would be appreciated !

     
 4.  Jasmine said on January 24, 2011 at 9:31 am:
     
     Wow, these code snippets are really good. I have been looking for a way to
     check if an email is valid on gmail! This code will be very helpful!

     
 5.  newvalidate said on February 3, 2011 at 4:06 pm:
     
     I get error “Warning: SMTP_validateEmail::require_once(Net_DNS.php)
     [function.SMTP-validateEmail-require-once]: failed to open stream: No such
     file or directory in D:\Hosting\4356713\html\smtpvalidateclass.php on line
     233
     “

     
 6.  Ousneo said on February 7, 2011 at 12:48 pm:
     
     @newvalidate you have to download NET_DNS class drom PEAR library!!
     
     I am having my IP reported as spammers !! how to solve this problem ?

     
 7.  Akhilesh thakur said on February 11, 2011 at 12:52 pm:
     
     I understand your code but this command not executed
     nslookup – q=mx reddit.com
     nslookup: couldn’t get address for ‘q=mx’: not found
     please help me

     
 8.  Secret Guy said on February 23, 2011 at 3:14 am:
     
     For me I encountered a lot of problem to send a resume through internet
     because of some error flash of my yahoomail so what can i do for this …

     
 9.  ram said on March 2, 2011 at 4:05 pm:
     
     Hi frnds i did not understood how to check, where to keep the email of
     users want to check var $user if ikeep like this $user=username of email
     iwant to check

     
 10. Lp Bell said on March 2, 2011 at 6:42 pm:
     
     I found the perfect tool:
     gives you 5 free validation for an email with the headers!!!!

     
 11. Boopathi Raja said on March 3, 2011 at 7:27 am:
     
     Hi All,
     
     I have a newsletter option which sends nearly 20,000 emails to my
     customers. I need to check if the email address is exist and active in real
     time before sending. Can anyone have the code to check this in PHP ? Please
     help me to resolve this issue

     
 12. mohan said on March 18, 2011 at 7:59 am:
     
     Thanks. simple and clear. I want to know is there any restriction to verify
     email addresses using this SMTP method.
     
     I want to verify 1 million email addresses. is it possible??
     
     Thanks in advance

     
 13. florin said on April 15, 2011 at 1:27 pm:
     
     You could use this application to check thousands of email account on more
     email addresses you have: bstdownload.com/reviews/valid-email-verifier-1/

     
 14. Gerold Setz said on April 27, 2011 at 7:44 pm:
     
     Thanks for the snippet.
     
     I’ll try to extend my service for detecting disposable email addresses (see
     block-disposable-email.com) with this kind of testing for the real
     existence of an email address as a second step. Unfortunately services like
     yahoo are always answering with “250”, so we have to assume that any email
     address exists there ..
     
     Gerold

     
 15. Searock said on May 23, 2011 at 11:11 am:
     
     Awesome technique !

     

 16. Pingback: Email validation script - SitePoint Forums

     
 17. Stephen Adams said on May 28, 2011 at 1:31 pm:
     
     well i am not for sure that there is a web site and this a phone
     nu.22998933573 they sent me.I am just trying to find out if this a leget
     place of bussines or a company.

     
 18. RapidSpeeds said on June 14, 2011 at 9:45 pm:
     
     Very nice guide, presented beautifully and easy to understand.

     
 19. Clueless said on June 16, 2011 at 10:51 pm:
     
     Sorry for being noobish but is this supposed to work with Windows? nslookup
     doesn’t understand the first line. There’s an identical question above.
     This would be a very useful function but the instructions are way, way,
     way, way, way, over mere mortals heads, assume you know the syntax of
     everything on any OS and Apollo 11’s LEM computer and mumble RFCs in your
     sleep. 🙂

     
 20. Miss Aydan Rifat said on July 2, 2011 at 7:08 pm:
     
     Dont know if there is anything wrong with my email address. If not how is
     it i cannot locate it and where do i access this. Having roblems cannot
     subscribe anywhere or receive emails. What am i doing wrong

     
 21. Bryan said on August 19, 2011 at 4:21 pm:
     
     Is there like a download that can do all that for you

     
 22. scott said on September 1, 2011 at 5:39 pm:
     
     ok so i took the python code from above and entered into my python idle
     shell script and got a syntax error??
     COMMAND:
     nslookup – q=mx bigcompanydomain.com

     
 23. scott said on September 1, 2011 at 5:46 pm:
     
     can i issue these commands thru a macintosh terminal?

     
 24. Rahul said on September 9, 2011 at 11:22 am:
     
     Good article. But this assumes that the smtp server runs on port 25 whcih
     may not be always true. for example, if the mail server uses secure SMTP,
     the port no will be 465 and we can’t get connection with simple telnet as
     it is secured.

     

 25. Pingback: Use PHP To Check Whether Remote URL, Email Or Image Link Exist «
     DBGLORY 4 YOU

     
 26. Naidu said on October 11, 2011 at 3:46 pm:
     
     If smtp is running on different port other than default (25), how to check
     this info? Any way using commands like nslookup?

     
 27. Omprakash said on November 8, 2011 at 6:15 am:
     
     This function giving me error while i am exicuting code, the error is
     
     Warning: Invalid argument supplied for foreach() in C:\wamp\www\Email
     Validation\smtpvalidateclass.php on line 90

     
 28. hussain said on November 26, 2011 at 9:13 am:
     
     my email id has been hacked now password is change how can i recover or
     delete my email id

     
 29. Muyeen said on December 2, 2011 at 6:20 pm:
     
     thanks… it was great….

     
 30. Virgil Bossard said on December 14, 2011 at 1:37 am:
     
     Hi. Just wanted to leave a quick remark and tell you that I’ve enjoyed
     viewing your personal site and will be recommending it to my mates. Keep up
     the good work! Thanks again.

     
 31. Mehdi said on January 9, 2012 at 7:29 pm:
     
     Very useful. Bundle of Thanks.

     
 32. Steven Lasch said on January 24, 2012 at 3:43 pm:
     
     In the PHP download, there is the following statements:
     // windows, we need Net_DNS
     require_once ‘Net/DNS.php’;
     
     Where can I download that include file?

     
 33. dilip kumar said on February 6, 2012 at 12:32 pm:
     
     hi ,
     i have a question please give the answer if anybody knows about follwing
     question .
     
     i wnat to know how can i check the email address present in gmail and
     facebook in my website?
     i mean email address present in gmail or facebook, from using that emial
     address , user can login in my website withought registration..

     
 34. Abeera said on February 29, 2012 at 10:39 am:
     
     I just love to add it at ysapak.com thanks for sharing it

     
 35. Scott Seong said on March 14, 2012 at 10:13 pm:
     
     This is a very helpful article, and I did have a chance to modify the
     script to suit my need. The modified script is available at:
     
     webtrafficexchange.com/smtp-email-address-validation
     
     I would like to contribute my change to Google Project, and need your help
     adding it to the project if you don’t mind.

     
 36. Bryan said on May 8, 2012 at 3:17 am:
     
     This doesn’t work with servers that use alternative SMTP ports (465 or 587)
     and I doubt it works if SSL is required or passwords are required.

     
 37. Bart said on August 29, 2012 at 8:17 am:
     
     For the people who are having trouble with the nslookup command line (I see
     2 in the comments above): the blogging system has messed up the command
     line, so don’t just copy/paste it. The actual option in the command line
     should read `-q=mx`, that is minus sign, “q”, “=”, “mx”, with no spaces in
     between.
     
     Also, when trying a nonexistent address in the SMTP server mentioned above,
     , it replied with “252 send some mail, i’ll try my best”. Well, that’s an
     interesting response…
     
     Also: the extra DNS lookup test on the domain name, as added by some
     commenters, is superfluous: that is part of what the nslookup is for.
     You’ll now just do 2 DNS lookups instead of one.

     

 38. Pingback: How to Verify if Email Address Exist or Not

     
 39. kim said on October 19, 2012 at 11:09 am:
     
     is there another easy method in finding if an email id exists

     
 40. Giovanni said on February 16, 2013 at 12:13 pm:
     
     Hi all and thank you for the code. It did really help me out a lot.
     
     However, I still have a problem on hotmail email address
     
     I did check it out and enabled SSL on my server, so now it’s working. The
     problem is that I still get this message back: error 530, could it means
     authentication required?
     Can you please help me?and give me some avdice?
     
     I am even thinking of buying it, if someone has a proper working script on
     PHP o ASP.
     
     Please write me at pcdevelopers@hotmail.com
     
     Thank you

     
 41. Roland said on February 26, 2013 at 9:39 pm:
     
     Great thanks to this usefull utility.
     I have just a comment. If I call the fonction with the following sequence,
     it doesn’t work.
     $email = ‘foo@gmail.com’;
     $result = $SMTP_Valid->validate($email, $sender);
     
     To be usable I have added this line in the function setEmails($emails) :
     settype($emails, “array”);
     
     Any reaction is welcome.

     


COMMENT NAVIGATION


Older Comments →

Comments are closed.

←   read more