How to check emailaddress is exists / not?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
php-pandit
Forum Newbie
Posts: 2
Joined: Thu May 25, 2006 8:00 am
Location: Bhuigaon, Vasai, Mumbai, Maharashtra, India
Contact:

How to check emailaddress is exists / not?

Post by php-pandit »

Hello,


What is the simplest way and how to check whether a given email address (or domain for this email) exists?

PLZ Help me out
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

This question was recently asked. Have you searched the boards yet?

viewtopic.php?t=51461
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

You can do this by checkdnsrr function.

Code: Select all

// take a given email address and split it into the username and domain.
list($userName, $mailDomain) = split("@", $email);
if (checkdnsrr($mailDomain, "MX")) {
  // this is a valid email domain!
}
else {
  // this email domain doesn't exist!
}
Cheers,
Dibyendra
Post Reply