dominicsayers/isemail

Checks an email address against the following RFCs: 3696, 1123, 4291, 5321, 5322

v3.0.7 2016-12-07 07:49 UTC

This package is not auto-updated.

Last update: 2024-10-26 19:05:28 UTC


README

Copyright 2008-2016 Dominic Sayers dominic@sayers.cc

https://isemail.info

BSD License (https://www.opensource.org/licenses/bsd-license.php)

How to use is_email()

  1. Add the downloaded file is_email.php to your project
  2. In your scripts use it like this:
	require_once 'is_email.php';
	if (is_email($email)) echo "$email is a valid email address";
  1. 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)";
	}
  1. Example scripts are in the extras folder

Version history