BillionVerify LogoBillionVerify

WordPress

Email checker for WordPress. Verify emails in contact forms, WooCommerce, and user registration.

Add real-time email verification to your WordPress site. Validate emails in contact forms, registration, and WooCommerce checkout.

Integration Methods

MethodBest ForComplexity
PluginQuick setupLow
Contact Form 7CF7 usersLow
WPFormsWPForms usersLow
Custom PHPFull controlMedium

Method 1: BillionVerify Plugin

Install our official WordPress plugin for the easiest integration.

Installation

  1. Go to PluginsAdd New
  2. Search for "BillionVerify Email Verification"
  3. Click Install Now then Activate
  4. Go to SettingsBillionVerify
  5. Enter your API key

Configuration

// wp-config.php (optional)
define('BV_API_KEY', 'bv_live_xxx');

Features

  • Real-time verification on all forms
  • Block disposable emails
  • Block role-based emails
  • Customizable error messages
  • WooCommerce integration
  • AJAX validation

Method 2: Contact Form 7

Add verification to Contact Form 7 forms.

Using Hooks

// functions.php
add_filter('wpcf7_validate_email*', 'billionverify_cf7_validation', 20, 2);

function billionverify_cf7_validation($result, $tag) {
    $email = isset($_POST[$tag->name]) ? sanitize_email($_POST[$tag->name]) : '';

    if (empty($email)) {
        return $result;
    }

    $verification = billionverify_check_email($email);

    if ($verification['status'] === 'invalid') {
        $result->invalidate($tag, 'Please enter a valid email address.');
    }

    if ($verification['result']['disposable']) {
        $result->invalidate($tag, 'Disposable emails are not allowed.');
    }

    return $result;
}

function billionverify_check_email($email) {
    $api_key = defined('BV_API_KEY')
        ? BV_API_KEY
        : get_option('billionverify_api_key');

    $response = wp_remote_post('https://api.billionverify.com/v1/verify/single', [
        'headers' => [
            'BV-API-KEY' => $api_key,
            'Content-Type' => 'application/json',
        ],
        'body' => json_encode(['email' => $email]),
        'timeout' => 10,
    ]);

    if (is_wp_error($response)) {
        return ['status' => 'unknown'];
    }

    return json_decode(wp_remote_retrieve_body($response), true);
}

Form Tag Configuration

[email* your-email class:billionverify-email]

Method 3: WPForms

Integrate with WPForms using custom validation.

PHP Validation

// functions.php
add_filter('wpforms_process_before_form_data', 'billionverify_wpforms_validation', 10, 2);

function billionverify_wpforms_validation($form_data, $entry) {
    foreach ($entry['fields'] as $field_id => $value) {
        $field = $form_data['fields'][$field_id] ?? null;

        if ($field && $field['type'] === 'email' && !empty($value)) {
            $verification = billionverify_check_email($value);

            if ($verification['status'] === 'invalid') {
                wpforms()->process->errors[$form_data['id']][$field_id] =
                    'Please enter a valid email address.';
            }

            if ($verification['result']['disposable'] ?? false) {
                wpforms()->process->errors[$form_data['id']][$field_id] =
                    'Disposable emails are not allowed.';
            }
        }
    }

    return $form_data;
}

Method 4: Custom PHP Integration

For complete control, integrate directly with our API.

Helper Class

<?php
// includes/class-billionverify.php

class BillionVerify {
    private $api_key;
    private $api_url = 'https://api.billionverify.com/v1';

    public function __construct($api_key = null) {
        $this->api_key = $api_key ?: get_option('billionverify_api_key');
    }

    public function verify($email) {
        $response = wp_remote_post($this->api_url . '/verify/single', [
            'headers' => [
                'BV-API-KEY' => $this->api_key,
                'Content-Type' => 'application/json',
            ],
            'body' => json_encode(['email' => $email]),
            'timeout' => 10,
        ]);

        if (is_wp_error($response)) {
            return [
                'success' => false,
                'error' => $response->get_error_message(),
            ];
        }

        $body = json_decode(wp_remote_retrieve_body($response), true);
        return [
            'success' => true,
            'data' => $body,
        ];
    }

    public function is_valid($email) {
        $result = $this->verify($email);
        return $result['success'] && $result['data']['status'] === 'valid';
    }

    public function is_disposable($email) {
        $result = $this->verify($email);
        return $result['success'] && ($result['data']['result']['disposable'] ?? false);
    }
}

Usage

$bv = new BillionVerify();

// Basic verification
$result = $bv->verify('user@example.com');

if ($result['data']['status'] === 'valid') {
    // Email is valid
}

// Quick checks
if ($bv->is_valid('user@example.com')) {
    // Process valid email
}

if ($bv->is_disposable('user@example.com')) {
    // Block disposable email
}

WordPress Registration

Verify emails during user registration.

// functions.php
add_filter('registration_errors', 'billionverify_registration_check', 10, 3);

function billionverify_registration_check($errors, $sanitized_user_login, $user_email) {
    $bv = new BillionVerify();
    $result = $bv->verify($user_email);

    if (!$result['success']) {
        return $errors; // Allow registration if API fails
    }

    $data = $result['data'];

    if ($data['status'] === 'invalid') {
        $errors->add('invalid_email',
            '<strong>Error</strong>: Please enter a valid email address.');
    }

    if ($data['result']['disposable'] ?? false) {
        $errors->add('disposable_email',
            '<strong>Error</strong>: Temporary email addresses are not allowed.');
    }

    return $errors;
}

AJAX Validation

Add real-time validation with JavaScript.

PHP Endpoint

// functions.php
add_action('wp_ajax_verify_email', 'billionverify_ajax_verify');
add_action('wp_ajax_nopriv_verify_email', 'billionverify_ajax_verify');

function billionverify_ajax_verify() {
    check_ajax_referer('billionverify_nonce', 'nonce');

    $email = sanitize_email($_POST['email'] ?? '');

    if (empty($email)) {
        wp_send_json_error(['message' => 'Email is required']);
    }

    $bv = new BillionVerify();
    $result = $bv->verify($email);

    if ($result['success']) {
        wp_send_json_success($result['data']);
    } else {
        wp_send_json_error(['message' => 'Verification failed']);
    }
}

// Enqueue scripts
add_action('wp_enqueue_scripts', 'billionverify_enqueue_scripts');

function billionverify_enqueue_scripts() {
    wp_enqueue_script('billionverify',
        get_template_directory_uri() . '/js/billionverify.js',
        ['jquery'],
        '1.0.0',
        true
    );

    wp_localize_script('billionverify', 'billionverify_ajax', [
        'url' => admin_url('admin-ajax.php'),
        'nonce' => wp_create_nonce('billionverify_nonce'),
    ]);
}

JavaScript

// js/billionverify.js
jQuery(function($) {
    $('input[type="email"]').on('blur', function() {
        var $input = $(this);
        var email = $input.val();

        if (!email) return;

        $input.addClass('verifying');

        $.post(billionverify_ajax.url, {
            action: 'verify_email',
            nonce: billionverify_ajax.nonce,
            email: email
        })
        .done(function(response) {
            $input.removeClass('verifying');

            if (response.success) {
                var data = response.data;

                if (data.status === 'invalid') {
                    showError($input, 'Please enter a valid email');
                } else if (data.result && data.result.disposable) {
                    showError($input, 'Disposable emails not allowed');
                } else {
                    showSuccess($input);
                }
            }
        })
        .fail(function() {
            $input.removeClass('verifying');
        });
    });

    function showError($input, message) {
        $input.addClass('error').removeClass('valid');
        $input.next('.bv-message').remove();
        $input.after('<span class="bv-message error">' + message + '</span>');
    }

    function showSuccess($input) {
        $input.addClass('valid').removeClass('error');
        $input.next('.bv-message').remove();
        $input.after('<span class="bv-message valid">✓</span>');
    }
});

CSS

/* style.css */
input[type="email"].verifying {
    background-image: url('spinner.gif');
    background-position: right 10px center;
    background-repeat: no-repeat;
}

input[type="email"].error {
    border-color: #dc3545;
}

input[type="email"].valid {
    border-color: #28a745;
}

.bv-message {
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.bv-message.error {
    color: #dc3545;
}

.bv-message.valid {
    color: #28a745;
}

Caching

Cache verification results to reduce API calls.

function billionverify_check_email_cached($email) {
    $cache_key = 'bv_email_' . md5($email);
    $cached = get_transient($cache_key);

    if ($cached !== false) {
        return $cached;
    }

    $result = billionverify_check_email($email);

    // Cache for 24 hours
    set_transient($cache_key, $result, DAY_IN_SECONDS);

    return $result;
}

Best Practices

1. Graceful Degradation

Always allow form submission if the API fails:

$result = $bv->verify($email);

if (!$result['success']) {
    // Log the error but don't block the user
    error_log('BillionVerify API error: ' . $result['error']);
    return; // Allow submission
}

2. Rate Limiting

Prevent abuse with rate limiting:

function billionverify_rate_limit($email) {
    $ip = $_SERVER['REMOTE_ADDR'];
    $key = 'bv_rate_' . md5($ip);
    $count = get_transient($key) ?: 0;

    if ($count >= 10) { // 10 verifications per minute
        return false;
    }

    set_transient($key, $count + 1, MINUTE_IN_SECONDS);
    return true;
}

3. Security

Always sanitize and validate inputs:

$email = sanitize_email($_POST['email']);

if (!is_email($email)) {
    // Invalid format, no need to call API
    return;
}

On this page