tags:

views:

106

answers:

2

Possible Duplicates:
What’s wrong with this RegEx for validating emails?
How to verify if a email address exists?
How to check if an email address exists without sending an email?

I was wondering if it was possible to validate an email address with php (w/library or without). When I say validate I don't mean a regex match I mean verify that the email address is actually a valid address in which emails can be sent.

+2  A: 

No, the only way you can truly validate an email is to send it an email containing a validation link.

Whit
Of course, that can be done with PHP.
David Zaslavsky
So what if I used the mail() function and it returned false?
Albinoswordfish
All that means is the PHP function failed. That says very little about whether the email address actually exists.
Whit
@Albino That still doesn't tell you anything
NullUserException
It is blatantly false that you can not validate an email. There are [some RFC validation libraries](http://www.dominicsayers.com/isemail/) available that will validate any internet-routable email address as *well-formed*. They won't validate local addresses or local domains properly. However, it is very true that sending an email to the address in question is *the best* way to ensure it's legit.
Charles
A: 

That is verification rather than validation, and yes it is possible and here is a tutorial which shows how you go about it.

Majid
Thank you, it's not full proof but it will be suitable for what I'm doing
Albinoswordfish
The regex in that article is *awful*. Please use a [RFC compliant validator](http://www.dominicsayers.com/isemail/) instead.
Charles
I won't be using the regex, but I like the idea of using DNS to at least verify the hostname.
Albinoswordfish