-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added disposable and free email APIs
- Loading branch information
1 parent
af16ff3
commit e0fe717
Showing
3 changed files
with
183 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ Add the following to your composer.json file: | |
|
||
``` | ||
"require": { | ||
"mailboxvalidator/mailboxvalidator-php": "1.0.*" | ||
"mailboxvalidator/mailboxvalidator-php": "1.1.*" | ||
} | ||
``` | ||
|
||
|
@@ -30,8 +30,8 @@ An API key is required for this module to function. | |
Go to https://www.mailboxvalidator.com/plans#api to sign up for FREE API plan and you'll be given an API key. | ||
|
||
|
||
Usage | ||
===== | ||
Usage for validating emails | ||
=========================== | ||
|
||
```php | ||
<?php | ||
|
@@ -195,6 +195,137 @@ The error code if there is any error. See error table below. | |
|
||
The error message if there is any error. See error table below. | ||
|
||
|
||
Usage for checking if an email is from a disposable email provider | ||
================================================================== | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
use MailboxValidator\SingleValidation; | ||
|
||
$mbv = new SingleValidation('PASTE_YOUR_API_KEY_HERE'); | ||
|
||
$results = $mbv->DisposableEmail('[email protected]'); | ||
|
||
if ($results === false) { | ||
echo "Error connecting to API.\n"; | ||
} | ||
else if (trim($results->error_code) == '') { | ||
echo 'email_address = ' . $results->email_address . "\n"; | ||
echo 'is_disposable = ' . $results->is_disposable . "\n"; | ||
echo 'credits_available = ' . $results->credits_available . "\n"; | ||
} | ||
else { | ||
echo 'error_code = ' . $results->error_code . "\n"; | ||
echo 'error_message = ' . $results->error_message . "\n"; | ||
} | ||
?> | ||
``` | ||
|
||
Functions | ||
========= | ||
|
||
### SingleValidation(api_key) | ||
|
||
Creates a new instance of the MailboxValidator object with the API key. | ||
|
||
### DisposableEmail(email_address) | ||
|
||
Check if the supplied email address is from a disposable email provider. | ||
|
||
Result Fields | ||
============= | ||
|
||
### email_address | ||
|
||
The input email address. | ||
|
||
### is_disposable | ||
|
||
Whether the email address is a temporary one from a disposable email provider. | ||
|
||
Return values: True, False | ||
|
||
### credits_available | ||
|
||
The number of credits left to perform validations. | ||
|
||
### error_code | ||
|
||
The error code if there is any error. See error table below. | ||
|
||
### error_message | ||
|
||
The error message if there is any error. See error table below. | ||
|
||
|
||
Usage for checking if an email is from a free email provider | ||
============================================================ | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
use MailboxValidator\SingleValidation; | ||
|
||
$mbv = new SingleValidation('PASTE_YOUR_API_KEY_HERE'); | ||
|
||
$results = $mbv->FreeEmail('[email protected]'); | ||
|
||
if ($results === false) { | ||
echo "Error connecting to API.\n"; | ||
} | ||
else if (trim($results->error_code) == '') { | ||
echo 'email_address = ' . $results->email_address . "\n"; | ||
echo 'is_free = ' . $results->is_free . "\n"; | ||
echo 'credits_available = ' . $results->credits_available . "\n"; | ||
} | ||
else { | ||
echo 'error_code = ' . $results->error_code . "\n"; | ||
echo 'error_message = ' . $results->error_message . "\n"; | ||
} | ||
?> | ||
``` | ||
|
||
Functions | ||
========= | ||
|
||
### SingleValidation(api_key) | ||
|
||
Creates a new instance of the MailboxValidator object with the API key. | ||
|
||
### FreeEmail(email_address) | ||
|
||
Check if the supplied email address is from a free email provider. | ||
|
||
Result Fields | ||
============= | ||
|
||
### email_address | ||
|
||
The input email address. | ||
|
||
### is_free | ||
|
||
Whether the email address is from a free email provider like Gmail or Hotmail. | ||
|
||
Return values: True, False | ||
|
||
### credits_available | ||
|
||
The number of credits left to perform validations. | ||
|
||
### error_code | ||
|
||
The error code if there is any error. See error table below. | ||
|
||
### error_message | ||
|
||
The error message if there is any error. See error table below. | ||
|
||
|
||
Errors | ||
====== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,5 @@ | |
"MailboxValidator\\": "src/" | ||
} | ||
}, | ||
"version": "1.0.0" | ||
"version": "1.1.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters