dominicsayers / isemail
Checks an email address against the following RFCs: 3696, 1123, 4291, 5321, 5322
Installs: 107 228
Dependents: 3
Suggesters: 0
Security: 0
Stars: 296
Watchers: 23
Forks: 46
Open Issues: 9
This package is not auto-updated.
Last update: 2024-11-09 19:19:59 UTC
README
Copyright 2008-2016 Dominic Sayers dominic@sayers.cc
BSD License (https://www.opensource.org/licenses/bsd-license.php)
How to use is_email()
- Add the downloaded file is_email.php to your project
- In your scripts use it like this:
require_once 'is_email.php'; if (is_email($email)) echo "$email is a valid email address";
- If you want to return detailed diagnostic error codes then you can ask is_email to do so. Something like this should work:
require_once 'is_email.php'; $email = 'dominic@sayers.cc'; $result = is_email($email, true, true); if ($result === ISEMAIL_VALID) { echo "$email is a valid email address"; } else if ($result < ISEMAIL_THRESHOLD) { echo "Warning! $email has unusual features (result code $result)"; } else { echo "$email is not a valid email address (result code $result)"; }
- Example scripts are in the extras folder