Let you want to validate an email address using php, address is firstname.lastname@example.org, if you use regular expression, it will pass validation properly but we know – this is not a real email address. So we need to check if an email address is exists or not – it can be done. I’ve created a php class that verify email address. Let me show you how to use this class –
Someone asked me if it’s possible to verify an email address if exists or not without sending any message, so far i know – its not possible to verify without sending any message. Let me explain the steps little how did i do that -
1. Check the pattern, this is public method, so you can use this method only if you want
2. Verify DNS
3. Verify/Get list of MX entries
4. Create socket with MX server.
5. Send messages and receive response code and analyse. If response returns with code “250″ for “RCPT TO:” message, that means mailbox exists.
Get the sourcecode with example here -
Git command line –
git clone git://github.com/appskitchen/emailverifier.git emailverifier
Hope this will help some people.