Email address verification/validation php class

Let you want to validate an email address using php, address is abc@yahoo.com, 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 –
http://github.com/appskitchen/emailverifier
or
Git command line –

git clone git://github.com/appskitchen/emailverifier.git emailverifier

Hope this will help some people.

Advertisements

34 thoughts on “Email address verification/validation php class

  1. Hi,
    I have tested ur code,but its not working for yahoo email addresses,it always says valid against yahoo address even if that address is invalid,also its not working for other domains like shaam@mydomain.com address.
    Plz help me to sort out this for yahoo addresses and for other domain addresses.
    Thanks
    shaam

    • Hi Shaam, its not guaranteed for accurate result. Sometimes it may fails for a valid email address sometimes it may show an email address is valid although it doesnt exists. All these depends on recipient mail server and your host. If email server doesn’t allow for socket connection or if your host ip is blacklisted – it may fails although email address is valid. If mail server reply you that email address exists although it doesnt exist consequences wrong results, same thing happens for yahoo mail server. So it depends on many things.

      Also, get updated class file.

  2. We belong in the Online Age, so let’s talk about submitting your resume online. There are many ways to submit your resume online. For the purpose of this article, I’m going to help you on how to submit a resume via email.

  3. Perhaps you would like it to have some system of lights to make your messages and images visible even at night. Or may be you would like your advertisement to be animated instead of displaying a static image. Audio effects are possible as well, so consider this possibility, especially if you take part in outdoor events.

  4. The spiritual aspect of Muay Thai boxing has made the sport dearer to the people of Thailand and other countries. This is evident from the number of people that throng the boxing rings every time the authorities release the schedule.

  5. Basel city also is flourishing on the conference and convention trade, with the vast Messe being Switzerland’s largest conference/exhibition centre. Delegates and attendees to major events often occupy hotels basel in the city, thus making reservations a must.

  6. Collaborative law is perfect for couples who want to avoid a nasty divorce. Their main concern is for the overall wellbeing of their children and they understand the consequences of a contentious divorce. Even though they don’t want to be married they also don’t want what’s left of their relationship to be destroyed by a legal process.

  7. thereby starting the shelf-life of the application with positive results and subsequent high sales figures. For the purpose of beta examination, a group of individuals are chosen to look for defects. Beta examination require plenty of planning

  8. hi i am getting the error Socket creation failed. Error no# 110, Error: Connection timed out
    any one can help me thanks

  9. The third step failed for me. I got ‘Socket creation failed. Error no# 110, Error: Connection timed out’; Any idea why this would happen. Its a HostGator web site.

  10. On some mailservers you get: 554 SMTP synchronization error
    You can correct this by handling the resonse from the mailserver on opening the socket to the mailserver. You sould also send a QUIT to the mailserver after you have checked the email address.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s