While you can check syntax of an email address (valid format) but can’t validate the existence of an email address without checking with the email domain name.
The PHP class encapsulates the SMTP transation between the remote domain, as well as the DNS lookup for the Mail Transfer Agent (MTA) responsible for that domain.
The class can take a number of email addresses, and return whether they are valid or not. It will group together emails with the same domain, and create a single SMTP connection to the MTA for those emails for efficiency.
Example usage
// include SMTP Email Validation Class require_once('smtp_validateEmail.class.php'); // the email to validate $email = '[email protected]'; // an optional sender $sender = '[email protected]'; // instantiate the class $SMTP_Validator = new SMTP_validateEmail(); // turn on debugging if you want to view the SMTP transaction $SMTP_Validator->debug = true; // do the validation $results = $SMTP_Validator->validate(array($email), $sender); // view results echo $email.' is '.($results[$email] ? 'valid' : 'invalid')."n"; // send email? if ($results[$email]) { //mail($email, 'Confirm Email', 'Please reply to this email to confirm', 'From:'.$sender."rn"); // send email } else { echo 'The email addresses you entered is not valid'; }
Reference : http://code.google.com/p/php-smtp-email-validation/