API To Detect Disposable Email Addresses

In the past we have seen ways to generate disposable information online to protect your privacy. Now this isn’t anything to do with general audience but useful for developers.

Today on the web we see a lot of disposable email addresses (such as 20minutemail – that is my favorite disposable email generator) which are used when we want to register at a new website instead of our real mail address.

If your site is getting disposable email rather than real subscribers then it is right time to use this free API to detect and reject disposable email addresses from submitting in forms or login fields.

How can this API be useful?

Using this API developers can create a system through which the website can detect and reject disposable email addresses submitted in their forms, thus preventing user from registering using fake email address.

This API is free so you can use in any kind of project you want. The code to detect disposable email address is as follows.

Using the API

Using the API is as easy as hitting a URL. Append the email address or domain name to check to the end.

GET https://open.kickbox.io/v1/disposable/mailinator.com HTTP/1.1

The response will be JSON with one boolean property, e.g. {"disposable":false}

$('#form').submit(function(e){
    var val = $("#emailOrDomain").val();
    var endpoint = "https://open.kickbox.io/v1/disposable/";

  //hit the api
  $.ajax({
    url: endpoint + encodeURIComponent(val);
  }).done(function(data) {
    console.log(data);
  }).error(function(data) {
    console.warn(data);
  });

  //cancel the submit event
  e.preventDefault();
});