Checking for live email addresses in PHP
Checking for live email addresses in PHP
Written by Mike James   
Monday, 23 August 2010
Article Index
Checking for live email addresses in PHP
Final Function



Using the function

To make everything fit together the complete function is:

function validateEmail($email){
list($name,$Domain) = split('@',$email);
foreach($POFFS as $PO )
$sock = fsockopen($PO, 25,
$errno, $errstr,  $timeout);
fwrite($sock, "HELO\n");
$response= getResponse($sock);
"MAIL FROM: <>\n");
$response= getResponse($sock);
fwrite($sock,"RCPT TO: <".$email.">\n");
$response= getResponse($sock);
list($code,$msg)=explode(' ',$response);
$response= getResponse($sock);
if ($code == '250') {
$result= true;
return $result;

To use the function you simply write something like:

if( validateEmail("name@domain")){
echo "valid";
echo "not valid";

There is a small possibility that if you use this sort of validation too often at any given site then you might be blacklisted, but as long as the frequency is low enough not to annoy it should be fine.


To access the code for this project, once you have registered,  click on CodeBin.


If you would like to be informed about new articles on I Programmer you can either follow us on Twitter, on Facebook or you can subscribe to our weekly newsletter.



Getting To Know WPF

WPF was Microsoft's killer UI construction kit - a second generation GUI. Then it looked as if it was on the way out but with Windows Forms in maintenance mode and a new interest in WPF it is still a  [ ... ]

Getting Started with Google Earth

Google Earth is more capable than Google Maps, but to use it you have to download a plug-in and learn a new API. This article explains that it's not so difficult and there are some easy to understand  [ ... ]

Other Projects





Last Updated ( Monday, 23 August 2010 )

RSS feed of all content
I Programmer - full contents
Copyright © 2015 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.