|
| 1 | +MailboxValidator PHP Module |
| 2 | +=========================== |
| 3 | + |
| 4 | +This PHP module provides an easy way to call the MailboxValidator API which validates if an email address is a valid one. |
| 5 | + |
| 6 | +This module can be used in many types of projects such as: |
| 7 | + |
| 8 | + - validating a user's email during sign up |
| 9 | + - cleaning your mailing list prior to an email marketing campaign |
| 10 | + - a form of fraud check |
| 11 | + |
| 12 | + |
| 13 | +Installation Using PHP Composer |
| 14 | +=============================== |
| 15 | + |
| 16 | +Add the following to your composer.json file: |
| 17 | + |
| 18 | +``` |
| 19 | +"require": { |
| 20 | + "mailboxvalidator/email-validation": "1.0.*" |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | + |
| 25 | +Dependencies |
| 26 | +============ |
| 27 | + |
| 28 | +An API key is required for this module to function. |
| 29 | + |
| 30 | +Go to http://www.mailboxvalidator.com/plans#api to sign up for FREE API plan and you'll be given an API key. |
| 31 | + |
| 32 | + |
| 33 | +Sample Usage |
| 34 | +============ |
| 35 | + |
| 36 | +```php |
| 37 | +require_once __DIR__ . '/vendor/autoload.php'; |
| 38 | + |
| 39 | +use MailboxValidator\SingleValidation; |
| 40 | + |
| 41 | +$mbv = new SingleValidation('PASTE_YOUR_API_KEY_HERE'); |
| 42 | + |
| 43 | +$results = $mbv->ValidateEmail(' [email protected]'); |
| 44 | + |
| 45 | +if ($results === false) { |
| 46 | + echo "Error connecting to API.\n"; |
| 47 | +} |
| 48 | +else if (trim($results->error_code) == '') { |
| 49 | + echo 'email_address = ' . $results->email_address . "\n"; |
| 50 | + echo 'domain = ' . $results->domain . "\n"; |
| 51 | + echo 'is_free = ' . $results->is_free . "\n"; |
| 52 | + echo 'is_syntax = ' . $results->is_syntax . "\n"; |
| 53 | + echo 'is_domain = ' . $results->is_domain . "\n"; |
| 54 | + echo 'is_smtp = ' . $results->is_smtp . "\n"; |
| 55 | + echo 'is_verified = ' . $results->is_verified . "\n"; |
| 56 | + echo 'is_server_down = ' . $results->is_server_down . "\n"; |
| 57 | + echo 'is_greylisted = ' . $results->is_greylisted . "\n"; |
| 58 | + echo 'is_disposable = ' . $results->is_disposable . "\n"; |
| 59 | + echo 'is_suppressed = ' . $results->is_suppressed . "\n"; |
| 60 | + echo 'is_role = ' . $results->is_role . "\n"; |
| 61 | + echo 'is_high_risk = ' . $results->is_high_risk . "\n"; |
| 62 | + echo 'is_catchall = ' . $results->is_catchall . "\n"; |
| 63 | + echo 'mailboxvalidator_score = ' . $results->mailboxvalidator_score . "\n"; |
| 64 | + echo 'time_taken = ' . $results->time_taken . "\n"; |
| 65 | + echo 'status = ' . $results->status . "\n"; |
| 66 | + echo 'credits_available = ' . $results->credits_available . "\n"; |
| 67 | +} |
| 68 | +else { |
| 69 | + echo 'error_code = ' . $results->error_code . "\n"; |
| 70 | + echo 'error_message = ' . $results->error_message . "\n"; |
| 71 | +} |
| 72 | +``` |
| 73 | + |
| 74 | + |
| 75 | +Copyright |
| 76 | +========= |
| 77 | + |
| 78 | +Copyright (C) 2017 by MailboxValidator.com, [email protected] |
0 commit comments