Mobile app version of vmapp.org
Login or Join
Odierno851

: Validating emails 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

@Odierno851

Posted in: #Crm #Email #Validation

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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Odierno851

1 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme