Function: is valid email

From PunBB Resource Wiki

Jump to: navigation, search
   The source code on this page is part of PunBB and is released under the GNU General Public License.
   Copyright (C) 2002-2005  Rickard Andersson.

Note, due to a limitation in MediaWiki this article's correct name is "Function: is_valid_email"

Description

bool **is_valid_email** ( string email )

Returns **TRUE** if the email is valid. Returns **FALSE** if email is longer than 50 chars, or invalid.


Source

email.php:

//
// Validate an e-mail address
//
function is_valid_email($email)
{
	if (strlen($email) > 50)
		return false;
 
	return preg_match('/^(([^<>()[].,;:s@"']+(.[^<>()[].,;:s@"']+)*)|("[^"']+"))@(([d{1,3}.d{1,3}.d{1,3}.d{1,3}])|(([a-zA-Zd-]+.)+[a-zA-Z]{2,}))$/', $email);
}

Back to functions list

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox