E-mail Validation

Last updated: September 14th, 2018

OVERVIEW

This API validates e-mails in "user@mail.com" format, checking also the smtp server.

REQUEST & RESPONSE

The API uses GET method to send request. Below you can find sample synax.

Request Method:

GET https://apineo.app/email-validation/?email=yourname@website.com

Response "VALID"

Below you can find a "valid" response sample.

Sample Request:

GET https://apineo.app/email-validation/?email=info@neoadvanced.com

Result:
{
    "success": true,
    "result": "valid",
    "email": "info@neoadvanced.com",
    "host": "neoadvanced.com",
    "smtp_check": "valid",
    "mx_record": "mail.neoadvanced.com",
    "execution_time_spent": 0.048582077026367188
}

Response "INVALID"

Below you can find an "invalid" response sample.

Sample Bad Request:

GET https://apineo.app/email-validation/?email=info@yourtt.com

Result:
{
    "success": true,
    "result": "invalid",
    "email": "info@yourtt.com",
    "smtp_check": "false",
    "info": "Only valid email addresses are allowed.",
    "valid_syntax_example": "https://apineo.app/email-validation/?email=yourname@website.com",
    "execution_time_spent": 0.12897109985351562
}

Response "ERROR"

Below you can find an "error" response.

Sample Bad Request:

GET https://apineo.app/email-validation/?ema

Result:
{
    "success": false,
    "error": "Error. You must provide an email address.",
    "valid_syntax_example": "https://apineo.app/email-validation/?email=yourname@website.com",
    "execution_time_spent": 5.817413330078125e-5
}

SAMPLE CODES

Below you can find a usage sample php code using cURL.

PHP Code Example
<?php 
//Validation function using cURL
function validate_email($email){
	$ch = curl_init("https://apineo.app/email-validation/?email=".$email."");  
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$json = curl_exec($ch);
	curl_close($ch);
	$validationResult = json_decode($json, true);
	if($validationResult["result"]=="valid"){
		return true;
	}else{
		return false;
	}
	
} 

//USAGE
if(validate_email("yourname@website.com")){
	//do success code ...
}else{
	//do error code ...
}
?>