RE: [PHP] Matching valid e-mail address
| From: | Wilkinson, Mark | Date: | Mon, 11 Sep 2000 09:41:00 +0000 |
| Subject: | RE: [PHP] Matching valid e-mail address | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16138@lists.php.net to get a copy of this message | ||
I came across a more thorough checker recently but I can't think where I
found it. It did checking via DNS and "MX" records to determine the validity
of the domain.
Cheers.
Mark W.
> -----Original Message-----
> From: Tero Ripattila [mailto:tero.ripattila@nic.fi]
> Sent: 11 September 2000 10:42
> To: php-general@lists.php.net
> Subject: [PHP] Matching valid e-mail address
>
>
> HI!
>
> I borrowed an example offered in this newsgroup some time ago
> and expanded
> it a little. I managed to get the function to accept an
> underscore (_)
> before the @-sing, but can't make it acceptable by the
> function after the
> @-sign.
>
> Could some Perl-guru give me a helping hand ?-)
>
> Here is the script:
> function check_email_syntax($email) {
> if( eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", $email) ||
>
> !eregi("^.+\@(\[?)[-a-zA-Z0-9\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$",
> $email)) {
> return(false);
> }
> else {
> list($user, $domain) = explode("@", $email);
>
> if ( (!eregi("^[a-zA-Z0-9\_\.\-]+$", $user)) ||
> (!eregi("^[a-zA-Z0-9\_\.\-]+$", $domain))) {
> return(false);
> }
> else {
> return(true);
> }
> }
> }
>
> Tero Ripattila
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
>