[pmwiki-users] test email adress

PKHG p.k.h.gragert at misc.utwente.nl
Mon Oct 26 02:55:22 CDT 2009


Thanks Dave,
Indeed, you allow much more complicated e-mail addresses, e.g. special
characters.

Is there 'somewhere' an official definition, what e-mail addresses may look
like?

     Peter

-----Oorspronkelijk bericht-----
Van: DaveG [mailto:pmwiki at solidgone.com] 
Verzonden: zondag 25 oktober 2009 21:33
Aan: Peter K.H. Gragert
CC: PmWiki Users
Onderwerp: Re: [pmwiki-users] test email adress

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