PHP Classes

File: examples/disposableEmailList.php

Recommend this page to a friend!
  Classes of John Conde   PHP Email Validation Library Pro   examples/disposableEmailList.php   Download  
File: examples/disposableEmailList.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Email Validation Library Pro
Validate email addresses using multiple rules
Author: By
Last change: Update of examples/disposableEmailList.php
Date: 12 days ago
Size: 637 bytes
 

Contents

Class file image Download
<?php

use EmailValidator\EmailValidator;

require(
'../vendor/autoload.php');

$testEmailAddresses = [
   
'test@gmail.com',
   
'test@hotmail.com',
   
'test@outlook.com',
   
'test@yahoo.com',
   
'test@example.com',
   
'test@nobugmail.com',
   
'test@mxfuel.com',
   
'test@cellurl.com',
   
'test@10minutemail.com',
];

$config = [
   
'checkDisposableEmail' => true,
];
$emailValidator = new EmailValidator($config);

foreach (
$testEmailAddresses as $emailAddress) {
   
$emailIsValid = $emailValidator->validate($emailAddress);
    echo (
$emailIsValid) ? 'Email is valid' : $emailValidator->getErrorReason();
    echo
PHP_EOL;
}