Check if email exist php -


i have question, have php script check if email address exist.

but appear yahoo, hotmail, aol , others providers accepting emails , not rejecting invalid emails.

only gmail, , many domains stackoverflow.com rejecting no vaild emails.

check script , let me know if can check yahoo , others.

html post form

<html> <body> <form action="checkemail.php" method="post"> <b>e-mail</b> <input type="text" name="email"> <input type="submit"> </form> </body> </html> 

php

<?php  /* validate email address. */ function jvalidateemailusingsmtp($stoemail, $sfromdomain = "gmail.com", $sfromemail = "email@gmail.com", $bisdebug = false) {      $bisvalid = true; // assume address valid default..     $aemailparts = explode("@", $stoemail); // extract user/domain..     getmxrr($aemailparts[1], $amatches); // mx records..      if (sizeof($amatches) == 0) {         return false; // no mx records..     }      foreach ($amatches $ovalue) {          if ($bisvalid && !isset($sresponsecode)) {              // open connection..             $oconnection = @fsockopen($ovalue, 25, $errno, $errstr, 30);             $oresponse = @fgets($oconnection);              if (!$oconnection) {                  $aconnectionlog['connection'] = "error";                 $aconnectionlog['connectionresponse'] = $errstr;                 $bisvalid = false; // unable connect..              } else {                  $aconnectionlog['connection'] = "success";                 $aconnectionlog['connectionresponse'] = $errstr;                 $bisvalid = true; // far good..              }              if (!$bisvalid) {                  if ($bisdebug) print_r($aconnectionlog);                 return false;              }              // hello server..             fputs($oconnection, "helo $sfromdomain\r\n");             $oresponse = fgets($oconnection);             $aconnectionlog['helo'] = $oresponse;              // send email from..             fputs($oconnection, "mail from: <$sfromemail>\r\n");             $oresponse = fgets($oconnection);             $aconnectionlog['mailfromresponse'] = $oresponse;              // send email to..             fputs($oconnection, "rcpt to: <$stoemail>\r\n");             $oresponse = fgets($oconnection);             $aconnectionlog['mailtoresponse'] = $oresponse;              // response code..             $sresponsecode = substr($aconnectionlog['mailtoresponse'], 0, 3);             $sbaseresponsecode = substr($sresponsecode, 0, 1);              // goodbye..             fputs($oconnection,"quit\r\n");             $oresponse = fgets($oconnection);              // quit code , response..             $aconnectionlog['quitresponse'] = $oresponse;             $aconnectionlog['quitcode'] = substr($oresponse, 0, 3);              if ($sbaseresponsecode == "5") {                 $bisvalid = false; // address not valid..             }              // close connection..             @fclose($oconnection);          }      }      if ($bisdebug) {         print_r($aconnectionlog); // output debug info..     }      return $bisvalid;  } $email = $_post['email'];  $bisemailvalid = jvalidateemailusingsmtp("$email", "gmail.com", "email@gmail.com"); echo $bisemailvalid ? "<b>valid!</b>" : "invalid! :("; ?> 

if need make super sure e-mail address exists, send e-mail it. should contain link random id. when link clicked, , contains correct random id, user's account activated (or ad published, or order sent, or whatever doing).

this reliable way verify existence of e-mail address, , make sure person filling in form has access it.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -