Are the email addresses in your database good enough?

What could be easier than check an email address? Obviously, at least two operations should be done.

First, to check the syntax of each email address. This task isn’t trivial and not only because some users have been registered in localized domains (like .在线, .இந்தியா, or .қаз).

Second task is to check if given email does exist at server. Again, quite difficult to make this task clear because the work with SMTP server isn’t always straightforward. That’s why for one of our projects we used external service to validate email addresses. And with that we have one additional benefit. Such email validators suggest checking a third email’s parameter: the quality. The email quality means whether this email is potentially readable reliably by contacts from your database.

We used Kickbox.io. The common and reasonable question “Why?” has the simple answer: “This tool is easy to use (simple API) and give credible results.”

The Kickbox has the next major features: first, user-friendly web-based interface; second, the tool allows to verify a single address or upload a CSV file containing a long list of email addresses. And third, files may be imported from computer or using API.

Kickbox.io API

In our situation we are much more interested to apply automatic email checking. Kickbox suggests API for Node.js, PHP, Ruby and Python . To start work with it we log in to our account, click on API Settings, then click Add API Key. This key is required to make requests to the Kickbox API. In order to issue a verification API call, developer needs the 3 following values:

Email (string) – The email address to be verified, URL encoded. API Key (string) – given Kickbox API key. Timeout (integer) (optional) – Maximum time, in milliseconds, for the API to complete a verification request. Default: 6000 ms.

One GET request can send one email. Important that the API is rate-limited to a maximum of 25 simultaneous connections per account.

A successful API call responds with the 12 pairs key-value. Interesting, that the one of these keys – the ‘reason‘ key may be in 11 different states (for example, ‘invalid_email‘, ‘rejected_email‘, ‘low_deliverability‘ and so one). Also, the response has interesting value ‘did_you_mean‘. Returns a suggested email if a possible spelling error was detected. (test123456@gamil.com -> test123456@gmail.com).

The third key that should be noticed here is ‘sendex float‘. Actually, Kickbox registered this name as trademark (The Sendex™) and it is indicator of the quality of an email address. “Just because an email exists and is syntactically correct, does not mean its quality” the Kickbox documentation says. For example, john.smith@example.com can generally be seen as a higher quality email address than sdfsdfsdf@example.com. Kickbox uses a number of algorithms, derived from the millions of email transactions it performs each hour, to determine the overall quality of an email address. How this tool does it you may read here. More important that at the output we have float value that says how good the email is. ‘How good‘ means how good response ability do have this email.

Kickbox calculated that good value is 0.55-1.0 for transactional email and 0.7-1.0 for marketing email .

Kickbox integration and results

Here is the code sample (see Listing 1.), how did we integrate Kickbox into one of our project.

public class KickBoxEmailVerification : IEmailVerification { public KickBoxEmailVerification () { _token = ConfigurationManager . AppSettings . Get ( " KickboxToken " ) ?? "" ; } public bool VerifyEmail ( string email ) { if ( string . IsNullOrEmpty ( _token )) return true ; // if ( string . IsNullOrEmpty ( email )) throw new ArgumentNullException ( " email " ) ; var client = new HttpClient { BaseAddress = new Uri ( Uri ), Timeout = TimeSpan . FromSeconds ( 6 ) }; // 6 seconds is default timeout value of kickbox service client . DefaultRequestHeaders . Accept . Add ( new MediaTypeWithQualityHeaderValue ( " application/json " )) ; var response = client . GetAsync ( String . Format ( UrlParamTemplate , email , _token )). Result ; if (! response . IsSuccessStatusCode ) return false ; var kickBoxResponse = JsonConvert . DeserializeObject < KickBoxResponse >( response . Content . ReadAsStringAsync (). Result ) ; return IValidEmail ( kickBoxResponse ) ; } public bool IsEnabled () { var val = ConfigurationManager . AppSettings [ " EnableKickboxEmailVerification " ] ; if ( string . IsNullOrEmpty ( val )) return false ; bool res ; return bool . TryParse ( val , out res ) && res ; } private static bool IValidEmail ( KickBoxResponse kickBoxResponse ) { return kickBoxResponse . result != " undeliverable " ; } private readonly string _token ; private const string Uri = " https://api.kickbox.io/v2/verify " ; private const string UrlParamTemplate = " ?email={0}&apikey={1} " ; } public class KickBoxResponse { public string result { get ; set ; } public string reason { get ; set ; } public bool role { get ; set ; } public bool free { get ; set ; } public bool disposable { get ; set ; } public bool accept_all { get ; set ; } public string did_you_mean { get ; set ; } public float sendex { get ; set ; } public string email { get ; set ; } public string user { get ; set ; } public string domain { get ; set ; } public bool success { get ; set ; } public string message { get ; set ; } }

Listing 1. Example of integration Node.js Kickbox API.

And then we can see our stats on the screen of Kickbox account (Picture 1.).



Picture 1. Screenshot of Kickbox account that shows dynamic of email verification.

A timeline (given at the bottom of Picture 1.) shows dynamic of emails checking were made during one week. We see how many validations we had, what emails quality were for them and some others parameters. For the last 7 days Kickbox has checked more than 48,000 emails and defined their Sendex (quality) as 0.661. Now we know about emails quality in the project database.

About Kickbox.io

Kickbox is online tool that verify email addresses within application using Real Time API. Email verification based on the SMTP. “Although this may seem trivial, there is a surprising level of complexity and overhead with this approach. SMTP is a chatty protocol, and mail servers often love to misbehave in unexpected ways“, the Kickbox’ web site is said.

Kickbox’ developers suggest API libraries for Node.js, PHP, Python, and Ruby. Kickbox guarantees no more than 5% of messages sent to “Deliverable” emails will bounce.