<?php
/*
	Stempora web framework
	copyright (c) 2002-2013 Stempora
		web:  www.stempora.com
		mail: support@stempora.com
*/



/**
* description
*
* @library	
* @author	
* @since	
*/
class Validate{
	
	static function Email($email){

		External::Load("swiftmailer");


		//try to use swift valiator, i use it for sending the mails so its the safest
		if (class_exists("Swift_Validate")) {
			return Swift_Validate::email($email);
		}
		
		//else try to use php functions if version >= 5.2.0
		if (function_exists("filter_var")) {
			return filter_var($email, FILTER_VALIDATE_EMAIL);
		} 

		$email_check = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i"; 

		if(preg_match($email_check,$email)){ 
				return true ;
		}
		
		return false;
	}
}


?>