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 NetDNSResolver 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
HELO email_domain
MAIL FROM: from@email.com
RCPT TO:
QUIT - 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