1

I am using a CRM with about 50k contacts in it and I really want to get serious about who we send information to. One of many steps in this is going to be email address validation.

Would writing a script that pings the server be enough? I am looking to weed out the true hard bounces from the list. Things like domain is no longer valid or email address that is clearly just complete rubbish (123@noemail.com) <- real example.

  • I guess you can start with doing a nslookup though slowly. It depends upon your connection providers DNS. For example, my DSL up-stream DNSs are usually topped out and nslookups will be limited because the DNS servers are already blocked. However, other providers offer up-stream DNS servers that are fairly open. My old DSL provider was good for this kind of automation. Open DNSs are always blocked. Try a few in code and see what you get. If it works, then apply a go slow approach and check the results. After that, you can use code and a telnet connection to validate the actual e-mail address. – closetnoc Oct 27 '16 at 18:54
  • Man. Lots of work. Aren't there any services that does this. I was able to validate all addresses in a matter of minutes. – dasickle Oct 27 '16 at 20:20
  • 1
    Well you can't ping a email address and pinging the domain will ping the A record not the MX. So you would need to whois the domain and then ping the MX server, but even then it doesn't proof the email address exists, also many email providers block ping responses. If you want higher success rates ask the person to supply the email twice with validation and don't ask unnecessary like a pop-up of some sort which forces users to enter a email address, similar to groupon does. The best thing would to remove failed emails addresses based on 3 attempts over X period. – Simon Hayter Oct 27 '16 at 20:32
2

The first step would be to do a check on the domain to identify the mail exchangers using the command...

nslookup -q=mx domain.com

You should receive a response similar to...

Non-authoratative answer:
domain.com mail exchanger = 0 mx1.domain.com
domain.com mail exchanger = 0 mx2.domain.com

NB: The number of records returned will be the number of MX records in the domains zone file.

Now that you know the address for the mail exchangers the next step would be to connect to the mail exchanger...

telnet mx1.domain.com 25

You should receive a response similar to

Connected to mx1.domain.com 25
Escape character is '^]'.
220 mx1.domain.com ESMTP

Command

helo hi

Response

250 mx1.domain.com

Command

mail from <your.address@yourdomain.com>

Response

250 2.1.0 Ok

Command

rcpt to: <destination.email@domain.com>

Now the following response will tell you if the email address exists on the server or not...

550 5.1.1 <destination.email@domain.com>: Recipient address rejected: Unknown user in virtual alias table

Command

quit

Response

221 2.0.0 Bye

Basically what this command and response sequence has done is emulate the same command and response sequence that your SMTP server would carry out in order to send an email to someone but only the first stages. By doing this check you will get a response to see if the email address exists or not. If it does then it is a valid email address (but doesn't mean it belongs to the user you expect is to) but if you get a 550 error response when doing the rcpt to check then that means that the email address doesn't currently exist on the mail server. You only need to check one of the mail exchangers with this command sequence as all of the mail exchangers should return the same data and should be working off a common address alias table for the same domain name.

This can be scripted but is a bit beyond the scope of the ProWebmasters SE, and can be done in whatever language you need to use. basically by wrapping it all in a function that returns a boolean value you can run the check and if any of the checks (no domain, no MX record, SMTP 550 error) then you can return false and the check is deemed to have failed and the email address is invalid and won't receive emails at that time.

  • Anyone who is comfortable with code can validate e-mail addresses as they are entered. I would not barf up an error, however, I would simply flag the email as suspicious. Another thing that can be done is to set a flag for any e-mail you get a bounce-back for. I used to run several e-mail lists back in the day, if an e-mail addy bounced, then it was suspended for a period. Enough suspensions, then the e-mail addy was removed. One thing I used to advise was using Majordomo in front of any SMTP server because it was so good at keeping spam out and because of the option I mentioned above. – closetnoc Oct 28 '16 at 0:40
  • Yeah...I am working with our email delivery vendor on integration between our CRM and their service. Goal is to send back opens and bounces and attach them back to individual records. – dasickle Oct 28 '16 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.