PHP Classes
elePHPant
Icontem

File: example2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of gabe  >  SMTP Email Address Validation Class  >  example2.php  >  Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: Email Address Validation Example2
Class: SMTP Email Address Validation Class
Validate e-mail address checking the SMTP server
Author: By
Last change:
Date: 6 years ago
Size: 847 bytes
 

Contents

Class file image Download
<?php

/**
 * Example 2
 * Validate a single Email via SMTP
 */

// include SMTP Email Validation Class
require_once('smtp_validateEmail.class.php');

// the email to validate
$emails = array('user@example.com', 'user2@example.com');
// an optional sender
$sender = 'user@yourdomain.com';
// 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($emails, $sender);

// view results
foreach($results as $email=>$result) {
       
// send email?
 
if ($result) {
   
//mail($email, 'Confirm Email', 'Please reply to this email to confirm', 'From:'.$sender."\r\n"); // send email
 
} else {
    echo
'The email address '. $email.' is not valid';
  }
}
?>