MxCheck PHP library

emails

This library can be used to check whether an email address is valid or not before sending any email.

This is not a syntax validation. It communicates with mail server and check whether the account is really existing or not.

The steps involved in this library are:

  1. Check syntax of email ( if it is not a valid email syntax wise , returns ERROR:EMAIL_SYNTAX )
  2. Find domain name from email address
  3. Get MX record using Net_DNS_Resolver library (return  ERROR:NO_MX if mx record cannot be found)
  4. Try to open port 25 of each MX server (return ERROR:NO_ACTIVE_MX if no response from any server )
  5. Send the following commands
    HELO email_domain
    MAIL FROM: <from@email.com>
    RCPT TO: <receiptant_email_here>
    QUIT
  6. If the response contain any error code (Numbers above 500  or timeout , it returns “ERROR:UNVERIFIED“)
  7. Else it returns SUCCESS

You can download the source code from : http://blog.sajithmr.me/MxCheck.txt

One thought on “MxCheck PHP library

Leave a Reply