• Post Reply Bookmark Topic Watch Topic
  • New Topic

Checking the domain name, whether it is existing or not  RSS feed

 
Ramesh Etta
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,

I am using java api, for sending a mail to the client.

Here i am able to check the format of the mailId, which needs to be sent.

But my problem here is , for example my mail id is ramesh@gmail.com, now i need to check whether gmail.com is existing or not in the internet, ie whether there is any addresss in the internet with the name gmail.com.

Please help me.

Thanks.
 
Iain Emsley
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I'm aware there is no way of knowing unless you get a bounce message from a non-deliverable address. I don't think that JavaMail can check MX records but the SMTP server should be able to do that for you.
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaMail can't but InetAddress surely can. Since Java 5.0 it has two methods called isReachable.
 
Paul Clapham
Sheriff
Posts: 22379
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are you suggesting this?

Surely not... but if not, then what?
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
So are you suggesting this?

Surely not... but if not, then what?


The question was to check whether or not gmail.com exists, not if the user exists on gmail.com.

That still does not guarantee that the mail server is available on this specific address (you will need the MX records like Iain suggested) but at least it's something.
 
Paul Clapham
Sheriff
Posts: 22379
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:

[CODE]That still does not guarantee that the mail server is available on this specific address (you will need the MX records like Iain suggested) but at least it's something.
True, it's something. But if gmail.com happens to be down when you do that -- and that does happen from time to time -- what should you conclude? That the address is not valid? I don't think you should conclude that. But then my opinion is that the original requirement is worthless. It's up to your SMTP server to deliver the message to the e-mail address as well as it can. It does that much better than a one-time check which may or may not provide some useful information. So just let the server do its job and don't try to second-guess it.
 
Ramesh Etta
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much for your reply.

I solved the problem using isReachable method

bye
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!