=== Better Email Validator ===
Contributors: deambulando
Donate link: https://paypal.me/chema/10EUR
Tags: email, email validation, registration, spam, disposable email
Requires at least: 6.0
Tested up to: 7.1
Stable tag: 1.2
Requires PHP: 7.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Validate email addresses on registration and forms, and block disposable domains.

== Description ==

Better Email Validator is a free, lightweight WordPress plugin that validates email addresses in real time, during registration and on any form that goes through the WordPress email check.

It does what the built-in WordPress check does not: besides the format, it also verifies that the domain really exists (it has DNS MX records) and that it is not a disposable or temporary email provider, the classic source of fake accounts and comment spam.

There is nothing to configure. Activate the plugin and every email address is checked:

1. **Format:** the address must follow RFC 822, the same rule WordPress uses.
2. **Domain:** the domain part must be a valid hostname.
3. **Disposable providers:** the domain is checked against a bundled list of more than 120,000 temporary email services (yopmail, mailinator, guerrillamail and company).
4. **MX records:** the domain must have a real mail server configured, so typos like `@gmial.com` are rejected.

= Why it helps =

- **Cleaner data:** no more accounts created with throwaway addresses you can never reach, and fewer bounces later.
- **Less spam:** most comment and registration spam comes from disposable providers, which are blocked before they enter your database.
- **Fewer typos:** a wrong domain still looks like a valid address, but it has no MX records, so it is caught.
- **Plug and play:** no settings screen, no API key, no external service, nothing sent anywhere.

= How it works =

The plugin hooks into the `is_email` filter, which WordPress uses for user registration, password resets, profile updates, comments and `wp_mail()` recipients. If any of the four checks fails, the address is rejected and WordPress shows its usual "not a valid email address" message.

The list of disposable domains ships inside the plugin as a plain text file and is refreshed with every plugin release, so validation does not depend on any external server at runtime. Site owners can also block their own domains with the `bev_banned_domains` filter, described in the FAQ.

== Installation ==

1. Install the plugin from the *Plugins > Add New* screen, or upload the `better-email-validator` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the *Plugins* menu in WordPress.
3. That's it. Try to register with an address from a disposable provider and you will see it rejected.

== Frequently Asked Questions ==

= Do I need an account or an API key? =

No. Everything runs on your own server. The plugin makes no calls to any external service when validating an address.

= Which forms does it cover? =

Any code that uses the WordPress function `is_email()`, which includes user registration, the profile screen, comments, password recovery and `wp_mail()`. Forms from other plugins that call `is_email()` or use `sanitize_email()` plus `is_email()` are covered too.

= Does it work with WooCommerce or contact form plugins? =

It depends on the plugin. If the form uses the WordPress API (`is_email()`) to validate the address, it is covered automatically. If the plugin has its own validator, it is not.

= What happens if a domain has no MX records but does receive mail? =

Some domains use an A record fallback instead of MX. In that rare case the address is rejected. You can allow it by removing the plugin filter with `remove_filter( 'is_email', ... )`.

= Can I add my own blocked domains? =

Yes, with the `bev_banned_domains` filter. It receives an associative array with the domains as keys:

`add_filter( 'bev_banned_domains', function ( $domains ) { $domains['example.com'] = 0; return $domains; } );`

= Does it slow down my site? =

No. The domain list is read once per request and kept as a single string of about 2 MB, so only the first email check pays for reading it (about 2 ms). MX lookups are cached by the operating system resolver.

== Changelog ==

= 1.2 =
* Fixed: the disposable domain list was downloaded from rawgit.com, a service that no longer exists. The download failed silently and the disposable check stopped working, so the plugin only validated format and MX. The list now ships with the plugin.
* Fixed: the domain was compared with the list without lowercasing it, so `YOPMAIL.COM` skipped the disposable check.
* Fixed: the list was read from disk on every email check; now it is loaded once per request.
* Fixed: `is_email` returned `true` instead of the email address, and it could turn a rejection into an acceptance. Now it respects the core result and returns the address, as the filter expects.
* Fixed: `FILTER_SANITIZE_STRING` is deprecated since PHP 8.1 and printed a notice on every check.
* Fixed: text domain `better-video` in the sponsor link, replaced with the correct one.
* Fixed: the declared license did not match between the plugin header and the readme.
* Fixed: duplicate and invalid tags in the readme, which made WordPress.org drop them.
* Tested up to WordPress 7.1.
* Improved the readme: description, features, FAQ and a proper changelog.

= 1.1 =
* Initial release.

== Upgrade Notice ==

= 1.2 =
Important: the disposable domain check was not working since rawgit.com went offline. This release fixes it and also catches domains written in uppercase. Tested up to WordPress 7.1.
