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:
- Check syntax of email ( if it is not a valid email syntax wise , returns ERROR:EMAIL_SYNTAX )
- Find domain name from email address
- Get MX record using Net_DNS_Resolver library (return ERROR:NO_MX if mx record cannot be found)
- Try to open port 25 of each MX server (return ERROR:NO_ACTIVE_MX if no response from any server )
- Send the following commands
MAIL FROM: <firstname.lastname@example.org>
RCPT TO: <receiptant_email_here>
- If the response contain any error code (Numbers above 500 or timeout , it returns “ERROR:UNVERIFIED“)
- Else it returns SUCCESS
You can download the source code from : http://www.sajithmr.me/MxCheck.txt