Jump to content

PHP Code / Script To check weather the given email exists in a domain


GIrish BM

Recommended Posts

Hi,

 

I want to implement the following in my web page

 

in sign up we will ask to enter user existing email id , so now i need to check weather the entered email currently available are not without sending any confirmation mail

 

can any body help me to write php script r code , atleast few examples on this one

 

Thanks In advance

 

regard's

girish

girish@pbminfotech.com

Link to comment
Share on other sites

With sending a verifiable email to that specific email address, there is no way of knowing if it truly exists unless you have access to the Database that contains the names configured for that domain. The Domain however you can check quite thoroughly.

 

You can use a WHOIS (id reccomend using a specialized Class). or you can just ckeck if it exists by asking for an ip address (one simple function does this in PHP).

 

-CB-

Link to comment
Share on other sites

ya as u said we need to write the php script to deal with whois server.

 

Simply checking the domain exists is no guarantee the email address exists. What your asking isn't possible.

 

You can check to see if the domain in the e-mail has an MX record (not that the physical address exists, but that is a valid acceptable address)

list($Email, $domain) = split("@", $Email, 2);
if (! checkdnsrr($domain, "MX")) { 
     die('E-mail does not exist') 
}else {
    $array = array($Email, $domain);
    $Email = implode("@", $array);
} 

Link to comment
Share on other sites

hi,

 

I want to implement the following in my web page

 

in sign up we will ask to enter user existing email id , so now i need to check weather the entered email currently available are not without sending any confirmation mail

 

 

here is my complete code for your php script can any body tell me what is wrong in this

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>

<body>

<form method="post">

<div>

<input type="text" name="email" /> <input type="submit" name="checkMail" value="Search Mail"/>

<?php

if(isset($_POST['checkMail'])){

$Email = $_POST['email']

list($Email, $domain) = split("@", $Email, 2);

if (! checkdnsrr($domain, "MX")) {

die('E-mail does not exist')

}else {

$array = array($Email, $domain);

$Email = implode("@", $array);

}

}

?>

</div>

</form>

</body>

</html>

 

Link to comment
Share on other sites

hi thrope

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>

<body>

<form method="post">

<div>

<input type="text" name="email" /> <input type="submit" name="checkMail" value="Search Mail"/>

<?php

if(isset($_POST['checkMail'])){

$Email = $_POST['email'];

list($Email, $domain) = split("@", $Email);

if (! checkdnsrr($domain, "MX")) {

die('E-mail does not exist');

}else {

$array = array($Email, $domain);

$Email = implode("@", $array);

}

}

?>

</div>

</form>

</body>

</html>

 

 

The above is my script. i think u know that i need to achieve this "as soon as user enter his email id i need to check weather it is used r not"

 

can u please suggest me some code.. i am getting o/p as blank page

 

the url :- http://pbminfotech.com/girish/test/

 

Link to comment
Share on other sites

It's great youve got this far bud but if you want real-time reaction or conditioning then you need to use AJAX/Java, i'd suggest reading one of the millions of tutorials out there on google.

 

Here, this will help you quicker and easier than here.

http://lmgtfy.com/?q=PHP+User+Registration+Tutorial

 

(Note: These forums are for helping fix your code, unfortunately you need to understand the basic structure of how php works and what you can do with it. For that, you need a dedicated tutorial for your level.)

 

-CB-

Link to comment
Share on other sites

Hi ChemicalBliss

 

i don't want to check the login details but i need to check on domain

for ex:- girishbm.gowda@gmail.com , if user enters this it should check in google

 

like that

 

There isn't a method of really doing this. Gmail uses MX records in a way that makes it impossible to view if the client e-mail exists or not. Only person.foo@randomsite.com will normally work. There's no reliable way to check if the e-mail exists, That is why confirmation e-mails are sent by almost every software that exists.

Link to comment
Share on other sites

There are 2 reasons why a confirm email is sent.

 

1 is as has been said, due to the near impossibility of determining programmatically if an address exists at a domain.

 

2 is because not only do we want to check that the address exists, but that the person registering has access to it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.