File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes verification of existence of email id Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "verification of existence of email id " Watch "verification of existence of email id " New topic

verification of existence of email id

Dinesh Babu

Joined: Jan 24, 2002
Posts: 1
Hi all,
Could any one of u pl suggest a way to verify the existence of an e mail Id using java code.

Dinesh Babu.

Thanks and rgds
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
You can check if it is a VALID email address by checking it against the corresponding RFC.
This mainly means there must be an @-sign somewhere in there with something in front and behind.
Then you could try a DNS lookup of the part after the @-sign. If that doesn't exist it's pointing to a non-existing domain and would therefore never arrive (not quite sure here, it is possible that for example dummy.somisp.sometld would arrive is only somisp.sometld is a valid DNS entry).
The part in front of the @-sign you can only determine the validity of by actually trying to send to the address. If you get a bounce (which may take a long time to arrive, some mailservers try repeatedly for a day or more to deliver in case a client address is only temporarilly unavailable) the address certainly does not exist.
If you get no bounce someone has received your message, but that may well be a blacklist and no recipient will ever read it.

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24166

Welcome to JavaRanch!
The SMTP standard includes a "VRFY" command which you used to be able to use to verify whether an email address was valid at a particular host. Nowadays, virtually all sites implement this as a no-op, so it's pretty much useless.
The only way that works is to send an email to the address containing a unique URL. The email should instruct the recipient to visit the URL. A servlet at the URL can then record that the corresponding email is valid.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: verification of existence of email id
Similar Threads
Identifying Client/Locking
Loading a page and then calling function
Encapsulation,Connascence and Contranascence
hibernate session: to close or not to close
WA #1.....word association