Re: Re: Quick email address check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 27, 2008 at 10:23 PM, Bill Guion <bguion@xxxxxxxxxxx> wrote:

> At 1:28 PM -0400 3/26/08, Al wrote:
>
> >I'm scripting a simple registry where the user can input their name
> >and email address.
> >
> >I'd like to do a quick validity check on the email address they just
> >inputted. I can check the syntax, etc. but want check if the address
> >exists.  I realize that servers can take a long time to bounce etc.
> >I'll just deal with this separately.
> >
> >Is there a better way than simply sending a test email to see if it
> bounces?
> >
> >Thanks....
>
> I've had pretty good success from the following:
>
> after checking the syntax (exactly one @, at least one . to the right
> of the @, etc.), if it passes the syntax check, I then set $rhs to
> everything to the right of the @. Then I test:
>
> if (!checkdnsrr($rhs, 'MX'))
>   {
>   invalid
>   }
> else
>   {
>   valid
>   }
>
>      -----===== Bill =====-----
> --
>
> You can't tell which way the train went by looking at the track.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I have used this to good effect

function isEmail($email)
{
     if
(eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}",$email))
  {
          return TRUE;
  } else {
          return FALSE;
     }
}//end function




-- 

Bastien

Cat, the other other white meat

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux