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('some.email.address@example.com', 'my.email.address@my-domain.com');
The first email address 'some.email.address@example.com' is the one to be checked, and the second 'my.email.address@my-domain.com' 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?
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('example@example.com');
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:
You should use this class like this :
$ve = new hbattat\VerifyEmail('email.to.check@domain.com', 'my.email@domain.com');
So you need a Smtp server configured with "my.email@domain.com" ready to send emails.
Regards
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.