Reputation: 4141
I am trying to use verifyEmail PHP library in my application.
I am following this link.
I am confused with this following line:
Initialize the class:
$ve = new hbattat\VerifyEmail('[email protected]', '[email protected]');
The first email address '[email protected]' is the one to be checked, and the second '[email protected]' is an email address to be provided to the server. This email needs to be valid and *from the same server that the script is running from*.
What does "email from same server..." mean?
Upvotes: 1
Views: 87
Reputation: 9
You should use this class like this :
$ve = new hbattat\VerifyEmail('[email protected]', '[email protected]');
So you need a Smtp server configured with "[email protected]" ready to send emails.
Regards
Upvotes: 1
Reputation: 1798
If you find that library too hard to use, you can try the following:
https://www.mailboxvalidator.com/php
To install via Composer:
"require": {
"mailboxvalidator/mailboxvalidator-php": "1.0.*"
}
Sample usage:
<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailboxValidator\SingleValidation;
$mbv = new SingleValidation('PASTE_YOUR_API_KEY_HERE');
$results = $mbv->ValidateEmail('[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 'domain = ' . $results->domain . "\n";
echo 'is_free = ' . $results->is_free . "\n";
echo 'is_syntax = ' . $results->is_syntax . "\n";
echo 'is_domain = ' . $results->is_domain . "\n";
echo 'is_smtp = ' . $results->is_smtp . "\n";
echo 'is_verified = ' . $results->is_verified . "\n";
echo 'is_server_down = ' . $results->is_server_down . "\n";
echo 'is_greylisted = ' . $results->is_greylisted . "\n";
echo 'is_disposable = ' . $results->is_disposable . "\n";
echo 'is_suppressed = ' . $results->is_suppressed . "\n";
echo 'is_role = ' . $results->is_role . "\n";
echo 'is_high_risk = ' . $results->is_high_risk . "\n";
echo 'is_catchall = ' . $results->is_catchall . "\n";
echo 'mailboxvalidator_score = ' . $results->mailboxvalidator_score . "\n";
echo 'time_taken = ' . $results->time_taken . "\n";
echo 'status = ' . $results->status . "\n";
echo 'credits_available = ' . $results->credits_available . "\n";
}
else {
echo 'error_code = ' . $results->error_code . "\n";
echo 'error_message = ' . $results->error_message . "\n";
}
?>
An API key is required but you can sign up for a free API key at below:
https://www.mailboxvalidator.com/plans#api
Upvotes: 2