PHP code example of kolaybi / mail-checker

1. Go to this page and download the library: Download kolaybi/mail-checker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kolaybi / mail-checker example snippets


use KolayBi\Validation\Mail\MailChecker;
use KolayBi\Validation\Mail\Exceptions\AbstractMailException;

try {
    MailChecker::check('[email protected]');
    // Email is valid
} catch (AbstractMailException $e) {
    // Handle specific validation errors
    echo $e->getMessage();
}

if (MailChecker::isValid('[email protected]')) {
    // Email is valid
} else {
    // Email is invalid
}

// Perform only local validation checks
MailChecker::check('[email protected]', skipExternalControl: true);

// Perform only local validation checks
if (MailChecker::isValid('[email protected]', skipExternalControl: true)) {
    // Email is valid
} else {
    // Email is invalid
}

// Check individual validation aspects
if (MailChecker::isWhitelisted('[email protected]')) {
    // Email domain is in whitelist - trusted domain
}

if (MailChecker::isBlacklisted('[email protected]')) {
    // Email domain is explicitly blocked
}

if (MailChecker::isDisposable('[email protected]')) {
    // Email is from a temporary/disposable email provider
}

if (MailChecker::isValidFormat('[email protected]')) {
    // Email format passes validation checks
}

// Inverse methods for negative checks
if (MailChecker::isNotWhitelisted('[email protected]')) {
    // Email 
bash
php artisan vendor:publish --provider="KolayBi\Validation\Mail\ServiceProvider"