We implemented the algorithm according to this article: http://www.labnol.org/software/verify-email-address/18220/. We connect to the SMTP server of the target email and simulate sending an email to that address, but we actually do not send it. Most of the SMTP servers would check to see if the target email is valid or not and tell our app. We use this response from the SMTP server to detect if it's an invalid email or not.
Please read on for a more detailed explanation.
Ping an Email Address to Validate it!
When you send an email to someone, the message goes to an SMTP server which then looks for the MX (Mail Exchange) records of the email recipient’s domain.
For instance, when you send an email to email@example.com, the mail server will try to find the MX records for the gmail.com domain. If the records exist, the next step would be to determine whether that email username (hello in our example) is present or not.
Using a similar logic, we can verify an email address from the computer without actually sending a test message. Here’s how:
Let say that we want to verify if the address firstname.lastname@example.org exists or not?
Step 1. Enable telnet in Windows or use the PuTTy tool. If you are on a Mac, open the iTerm app.
Step 2. At the command prompt, type the nslookup command:
nslookup –type=mx gmail.com
This nslookup command will query name servers for that domain. Since we have specified the type as MX, our command will extract and list the MX records of the email domain. Replace gmail.com with the domain of the email address that you are trying to verify.
gmail.com MX preference=30, exchanger = alt3.gmail-smtp-in.l.google.com gmail.com MX preference=20, exchanger = alt2.gmail-smtp-in.l.google.com gmail.com MX preference=5, exchanger = gmail-smtp-in.l.google.com gmail.com MX preference=10, exchanger = alt1.gmail-smtp-in.l.google.com gmail.com MX preference=40, exchanger = alt4.gmail-smtp-in.l.google.com
Step 3. As you may have noticed in the nslookup output, it is not uncommon to have multiple MX records for a domain. Pick any one of the servers listed in the MX records, may be the one with the lowest preference level number (in our example, gmail-smtp-in.l.google.com), and “pretend” to send a test message to that server from you computer.
For that, go to the command prompt window and type the following commands in the listed sequence:
3a: Connect to the mail server:
telnet gmail-smtp-in.l.google.com 25
3b: Say hello to the other server
3c: Identify yourself with some fictitious email address
3d: Type the recipient’s email address that you are trying to verify:
The server response for ‘rcpt to’ command will give you an idea whether an email address is valid or not. You’ll get an “OK” if the address exists else a 550 error like:
- email@example.com – The email account that you tried to reach does not exist.
- firstname.lastname@example.org – The email account that you tried to reach is disabled.
That’s it! If the address is valid, you may perform reverse email search to find the person behind the address.
I really like to read your blog here it is the very nice there are the one of the best enjoyments by puzzle to join the here play bejeweled 3 free game have to need follow the all tips online here and getting the batter score to all play any time hope you can like this way here.
Please sign in to leave a comment.