PHP Classes

File: examples/disposableEmailListWithCustomDomains.php

Recommend this page to a friend!
  Classes of John Conde  >  PHP Email Validation Library Pro  >  examples/disposableEmailListWithCustomDomains.php  >  Download  
File: examples/disposableEmailListWithCustomDomains.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:
Date: 1 year ago
Size: 743 bytes
 

Contents

Class file image Download
<?php

use EmailValidator\EmailValidator;

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

$customDisposableEmailList = [
   
'example.com',
];

$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,
   
'disposableList' => $customDisposableEmailList,
];
$emailValidator = new EmailValidator($config);

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

For more information send a message to info at phpclasses dot org.