Skip to main content

Email Address Verification

It is also possible to perform email address verification without relying on the widget system. This process is independent of the widget and requires a server-side email verification implementation. As a result, there is no need to load a widget if you only want to check the validity of email addresses.

email addresses

By verifying email addresses with our API, you can ensure that only qualified users gain access to your services while ensuring secure delivery of your emails to their inboxes. With this verification, you can easily deny access or block users with temporary email addresses. This feature guarantees that they always enter the correct email address, which protects your mail server's reputation and saves you money.

Verifying email addresses works in the same way as the captcha solution, only the endpoint is different (/emailverify). Again, to avoid exposing your secret key, you should only do this on your server.

You will need your secret key. This can be generated automatically when you add a project to your dashboard or by using an existing project. To ensure that this is a valid email address that can receive emails, you will verify the email address with the API endpoint. You will also ensure that it is not a disposable email address.

To verify email addresses, make a POST request to

https://www.zencaptcha.com/captcha/emailverify

with the following parameters:

Post ParameterDescription
secretYour secret key (simply add a project to your dashboard or use an existing project)
emailOptional: User email address. Alternatively, you can obfuscate the first part before the @ symbol (john@example.com -> xxx@example.com), or simply specify the domain name of the email address (for maximum privacy: example.com).
Use POST

Do not use a GET request to call /emailverify (or it will fail)

curl example​

Change john@example.com and YOUR-SECRET-KEY with your values:

curl
curl https://www.zencaptcha.com/captcha/emailverify
-X POST
-H "Content-Type: application/x-www-form-urlencoded"
-d 'email=john@example.com&secret=YOUR-SECRET-KEY'

Summary of the POST request response​

Response KeyDescription
successtrue means that the email address is valid and it is not a disposable or temporary email address.
false means that it is an invalid or disposable / temporary email address. Use emailvalid to find out more.
emailvalid"valid_email" means that it is valid. (Ideally, you should only check that it is "valid_email"). "invalid_email" means that it is an invalid email address or that it would not be possible to deliver emails to this email address. "disposable_email" means that it is a disposable or temporary email address. "upgrade_plan" means that you need to be on a paid plan to use this feature or that. "none" means that the email address was not checked (probably no email address send for verification)

Examples: PHP / Node / Python / Ruby​

PHP
$email = $_POST['email'];

$secret = "YOUR-SECRET-KEY"; //never share your key

$data = array(
"secret" => $secret,
"email" => $email, //email address of the user
);

$options = array(
"http" => array(
"header" => "Content-type: application/x-www-form-urlencoded",
"method" => "POST",
"content" => http_build_query($data),
),
);

$context = stream_context_create($options);
$verify = file_get_contents("https://www.zencaptcha.com/captcha/emailverify", false, $context);
$email_success = json_decode($verify);

if ($email_success->success==false) {
#invalid email address (don't trust the user)
#email_success["emailvalid"] -check if "invalid_email" or "disposable_email". Ideally it should only be "valid_email"
exit();
}
else{
//valid email address - continue with your code
}