innocode-digital/wp-mailgun-email-validation

Validates email address through Mailgun.

Installs: 11 679

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 14

Forks: 1

Open Issues: 0

Type:wordpress-muplugin

1.2.0 2020-04-21 15:45 UTC

This package is auto-updated.

Last update: 2024-10-29 05:53:24 UTC


README

Description

Validates email address through Mailgun.

Install

  • Preferable way is to use Composer:

    composer require innocode-digital/wp-mailgun-email-validation
    

    By default it will be installed as Must Use Plugin. But it's possible to control with extra.installer-paths in composer.json.

  • Alternate way is to clone this repo to wp-content/mu-plugins/ or wp-content/plugins/:

    cd wp-content/plugins/
    git clone git@github.com:innocode-digital/wp-mailgun-email-validation.git
    cd wp-mailgun-email-validation/
    composer install
    

If plugin was installed as regular plugin then activate Mailgun Email Validation from Plugins page or WP-CLI: wp plugin activate wp-mailgun-email-validation.

Usage

Add required constant (usually to wp-config.php):

define( 'MAILGUN_API_KEY', '' );

or

define( 'MAILGUN_APIKEY', '' );

You could use either one of these constants. MAILGUN_APIKEY is used also by Mailgun for WordPress plugin.

Documentation

By default plugin skips admin_email from validation but it's possible to enable it:

add_filter( 'innocode_mailgun_email_validation_skip_admin_email', function ( $skip, $email ) {
    return $skip;
} );

By default plugin skips users email from validation but it's possible to enable it:

add_filter( 'innocode_mailgun_email_validation_skip_user_email', function ( $skip, $email ) {
    return $skip;
} );

By default plugin checks if email address has deliverable or unknown status and hasn't high risk but it's possible to set own criteria:

add_filter( 'innocode_mailgun_email_validation_validated', function ( $validated, array $email ) {
    return $validated;
} );

It's possible also to use validate and is_valid methods from plugin:

  • innocode_mailgun_email_validation()->get_client()->validate( $email ) - validates email address with Mailgun Email Validation.

  • innocode_mailgun_email_validation()->is_valid( $email ) - uses previous method but also applies filters and caches result, returns boolean value.