I received lot of requests from my readers regarding how to check email address exists or not in PHP. It help us to avoid invalid emails added into their database. In this tutorial, we can easily check email address is exists or not using Kickbox API

Kickbox makes it easy to verify your email lists, or integrate email verification into your application with their API. Kickbox verifies email addresses using the Simple Mail Transfer Protocol (SMTP).

Step 1: Create a Free Kickbox Account

Getting started with Kickbox is free. Your account comes with 100 free verifications.  Click here to sign up.

After registration and login into Kickbox, you can see 100 free verifications added into your account

100 free email verifications

Step 2: Verifying Email Addresses With Kickbox API

Kickbox’s API can be integrated into your web applications to verify email addresses in real-time.

Kickbox Verify API PHP

You need to Create a Verification App to generate an API key. I created the app with the name called “w3lessons

Email Verification App

After created the APP, you can see the API with usage statistics overall. Please get the API from this dashboard

API Key to call API

Step 3 : API usage in PHP Curl

API EndPoint

https://api.kickbox.io/v2/verify?email=bill.lumbergh@gamil.com&apikey=your-api-key

PHP code to validate email address using CURL. below code will convert json into php object

function get_curl($url)
{
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
	$res=curl_exec($ch);
	curl_close($ch);
	$result=json_decode($res,true);
	return $result;
}

$apikey = "your api key";
$email = "bill.lumbergh@gamil.com";
$url = 'https://api.kickbox.io/v2/verify?email='.$email.'&apikey='.$apikey;
$response = get_curl($url);
print_r($response);

Response after executing kickbox API using PHP CURL

{
  "result":"undeliverable",
  "reason":"rejected_email",
  "role":false,
  "free":false,
  "disposable":false,
  "accept_all":false,
  "did_you_mean":"bill.lumbergh@gmail.com",
  "sendex":0,
  "email":"bill.lumbergh@gamil.com",
  "user":"bill.lumbergh",
  "domain":"gamil.com",
  "success":true,
  "message":null
}

If the result field is undeliverable then the email address is invalid

A successful API call responds with the following values:

  • result string – The verification result: deliverable, undeliverable, risky, unknown
  • reason string – The reason for the result. Possible reasons are:
    • invalid_email – Specified email is not a valid email address syntax
    • invalid_domain – Domain for email does not exist
    • rejected_email – Email address was rejected by the SMTP server, email address does not exist
    • accepted_email – Email address was accepted by the SMTP server
    • low_quality – Email address has quality issues that may make it a risky or low-value address
    • low_deliverability – Email address appears to be deliverable, but deliverability cannot be guaranteed
    • no_connect – Could not connect to SMTP server
    • timeout – SMTP session timed out
    • invalid_smtp – SMTP server returned an unexpected/invalid response
    • unavailable_smtp – SMTP server was unavailable to process our request
    • unexpected_error – An unexpected error has occurred
  • roletrue | falsetrue if the email address is a role address (postmaster@example.com,support@example.com, etc)
  • freetrue | falsetrue if the email address uses a free email service like gmail.com or yahoo.com.
  • disposable true | falsetrue if the email address uses a disposable domain like trashmail.com or mailinator.com.
  • accept_all true | falsetrue if the email was accepted, but the domain appears to accept all emails addressed to that domain.
  • did_you_mean null | string – Returns a suggested email if a possible spelling error was detected. (bill.lumbergh@gamil.com -> bill.lumbergh@gmail.com)
  • sendex float – A quality score of the provided email address ranging between 0 (no quality) and 1 (perfect quality). More information on the Sendex Score can be found here.
  • email string – Returns a normalized version of the provided email address. (BoB@example.com ->bob@example.com)
  • user string – The user (a.k.a local part) of the provided email address. (bob@example.com -> bob)
  • domain string – The domain of the provided email address. (bob@example.com -> example.com)
  • success true | falsetrue if the API request was successful (i.e., no authentication or unexpected errors occurred)

The API is rate-limited to a maximum of 25 simultaneous connections per account. As you integrate the Kickbox API, ensure your application does not exceed this limit

Alternatively you can also use php library to verify email address – https://github.com/kickboxio/kickbox-php

View Live Demo

 

 

If you enjoyed this article, Get email updates (It’s Free)
http://w3lessons.info/wp-content/uploads/2016/04/output_j3bBFa.gifhttp://w3lessons.info/wp-content/uploads/2016/04/output_j3bBFa-150x150.gifKarthikeyan KFreebiesPHPAPI,new techniques,php
I received lot of requests from my readers regarding how to check email address exists or not in PHP. It help us to avoid invalid emails added into their database. In this tutorial, we can easily check email address is exists or not using Kickbox APIKickbox makes it easy to...