PHP Classes

File: example1.php

Recommend this page to a friend!
  Classes of gabe  >  SMTP Email Address Validation Class  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: Email Address Validation Example1
Class: SMTP Email Address Validation Class
Validate e-mail address checking the SMTP server
Author: By
Last change:
Date: 14 years ago
Size: 849 bytes


Class file image Download
 * Example 1
 * Validate a single Email via SMTP

// include SMTP Email Validation Class

// the email to validate
$email = '';
// an optional sender
$sender = '';
// 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."\r\n"); // send email
} else {
'The email addresses you entered is not valid';