什么是服务器电子邮件地址?

时间:2018-02-07 08:23:56

标签: php email email-validation

我正在尝试在我的应用程序中使用verifyEmail PHP库。

我正在关注this链接。

我对以下这一行感到困惑:

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*. 

“来自同一台服务器的电子邮件......”是什么意思?

2 个答案:

答案 0 :(得分:2)

如果您发现该库太难使用,可以尝试以下操作:

https://www.mailboxvalidator.com/php

通过Composer安装:

"require": {
    "mailboxvalidator/mailboxvalidator-php": "1.0.*"
}

样本用法:

<?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";
}
?>

需要API密钥,但您可以在以下位置注册免费的API密钥:

https://www.mailboxvalidator.com/plans#api

答案 1 :(得分:1)

你应该像这样使用这个类:

$ve = new hbattat\VerifyEmail('email.to.check@domain.com', 'my.email@domain.com');

因此,您需要配置了“my.email@domain.com”的Smtp服务器,以便发送电子邮件。

此致