If you have a site that takes in user information, specifically email addresses, then you'll be overjoyed to know that there's a quick and easy way to validate that email adddress - and not just "oh, that looks like an email address! you passed!"
In this latest article from SitePoint, they show you how, using the checkdnsrr() function (not availible on Windows), to check and make sure that a MX record exists for the domain that the email address is coming from. Now, obviously, you'd probably want to use a regular expression to check and see that the address is valid first, but beyond that, you can use this information to help validate that domain. And, yes, for you Windows users out there, they do have a "workaround" for you that uses a command-line call that will work pretty much the same way.
While there's no foolproof way to make sure a user isn't giving you a completely bogus email address, you can at least help cut down on the problem by making sure that email addresses your site is given at least correspond to a real domain.




