[pmwiki-users] test email adress

DaveG pmwiki at solidgone.com
Sun Oct 25 15:32:44 CDT 2009


Checking for a valid email address can get very complex, to accommodate 
all scenarios. Here's what I use:

function bi_IsEmail($e){
	return (bool)preg_match(
	 
"/^[-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?$/iD"
		,$e);
}


  ~ ~ Dave

Peter K.H. Gragert wrote:
> Hello,
> 
> I just started to use pmforms.php, especially the mail part.
> 
>  
> 
> On the site there is an idea to check if an email address contains an 
> @-sign.
> 
>  
> 
> I use this one
> 
>  
> 
> function valid_mail($str)
> 
> {
> 
>     return (ereg 
> ('(^[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+)*@([0-9a-zA-Z_\-]{1,}\.)+[0-9a-zA-Z]{2,}$)', 
> $str));
> 
> }
> 
>  
> 
>  
> 
> Is there an even (much) better one?
> 
>  
> 
> Greets
> 
>        Peter
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
> 
> 
> ------------------------------------------------------------------------
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 9.0.695 / Virus Database: 270.14.31/2458 - Release Date: 10/25/09 04:10:00
> 



More information about the pmwiki-users mailing list