Re: Quick email address check

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

 



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....

There may be a SMTP class to help you do it, or you can do it manually
but here is a quick process.  Look up the MX for thedomain.com. maybe
use  checkdnsrr(). If not found then it is bad, if found connect and
issue the following SMTP commands:

MAIL FROM: me@xxxxxxxxxxx
250 ok
RCPT TO: nonexistant@xxxxxxxxxxxxx
550 sorry, no mailbox here by that name. (#5.7.17)

Optimally you want to see:
250 ok

You could also see:
553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)

This would mean that there is an MX record for thedomain.com pointing to
this server but this server isn't configured to accept mail for this domain.


-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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