We've all seen it happen.
You put up a registration page on your site, hoping that visitors will leave you their email addresses so that you can stay in touch with them when you've got a new product for sale. Or a new tutorial that they might be interested in. Or you want to send them some "information from carefully screened third parties with whom we maintain a strategic relationship." Or maybe you want something in return before you give them that valuable whitepaper that you spent two months completing.
Whatever the reason, you happily construct your registration page, set up a database table to track the incoming email addresses, and publish it live. And sure enough, the registrations start coming in.
To firstname.lastname@example.org. And email@example.com. And firstname.lastname@example.org. You get the idea -- users are registering with bogus email addresses at domains that don't even exist. Not only are you going to be sending mail to nonexistent addresses, but they clutter up your database and cause maintenance headaches because they need to be cleaned out.
Make Sure They're at Least Real
One way to help address this problem is to make sure that a user's email address actually corresponds to a real email domain. Using PHP, you can check the domain registration records to see if the domain a user submitted to your site is real. To do this, we'll use PHP's