PHP code example of xylis / mailboxlayer-client

1. Go to this page and download the library: Download xylis/mailboxlayer-client 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/ */

    

xylis / mailboxlayer-client example snippets


$client = new Xylis\MailboxLayer\Client('YOUR_API_KEY');

// Check if the email is valid
$client->validate('[email protected]')->isValid();

$client = new Xylis\MailboxLayer\Client(string $apiKey, bool $smtpCheck = true, bool $prettyFormat = false, bool $catchAllCheck = false)

$email = $client->validate('[email protected]');

// Check if the email is valid
$email->isFormatValid();

// Check if the email format is valid
$email->isFormatValid();

// Check if the email format is valid
$email->isMxFound();

// Check if email address exists, return false if not
$email->isSmtpValid();

// Get the email address (return [email protected])
$email->getMail();

// Get the user from email address (return email)
$email->getUser();

// Get the domain from email address (return ddress.com)
$email->getDomain();

// Get suggestion if the email address is misspelled 
$email->getSuggestion();

// Get quality score between 0 (bad) and 1 (good)
$email->getQualityScore();

// Check if email address is free delivered (domains like gmail.com and yahoo.com)
$email->isFreeDeliveredEmailAddress();

// Check if email address is disposable (trash & temporary mailbox)
$email->isDisposable();

// Check if email address is a role mail address (like support)
$email->isRoleEmailAddress();

$client->validate(string $emailAddress, bool $bypassFilterValidation = false);