FILTER_VALIDATE_EMAIL probably is a smarter way to go, but I think context matters a lot. If this is for a consumer web service user@hostname isn't going to be 'valid' for the service.
If this is for a consumer web service, user@existing.dns for a non-existing mail box will be 'valid' according to this link, but still completely useless.
Please see the link I posted.
1/ Using PHP PCRE for email validation is considered harmful
2/ Using filter_var for email validation for a web service is useless
3/ Sending a confirmation link by email is the way to go
I think you're missing the point. The idea is to provide incremental knowledge about the validity of the address, both to the user and to the service. user@existing.dns will validate but user@exsiting.dns won't. There is real value in providing that feedback immediately, rather than forcing the user to realize after waiting for an email that will never arrive that they made a trivial mistake.
To be clear, I agree with you 100% that there is no substitute for sending a confirmation email and requiring the user to click-through if you're looking for full confirmation of mailbox validity. My point is that there are simple steps to be taken along that path which complement the confirmation email.
4 comments
[ 3.5 ms ] story [ 16.5 ms ] threadThe right way is
Same for validating the domain. And also : http://news.ycombinator.com/item?id=4486108Please see the link I posted.
1/ Using PHP PCRE for email validation is considered harmful
2/ Using filter_var for email validation for a web service is useless
3/ Sending a confirmation link by email is the way to go
To be clear, I agree with you 100% that there is no substitute for sending a confirmation email and requiring the user to click-through if you're looking for full confirmation of mailbox validity. My point is that there are simple steps to be taken along that path which complement the confirmation email.