API Client Code Examples

Do you need to call Verimail API from your PHP, Java, Javascript or Python code? We developed and tested these code examples so you you dont have to do it yourself. All you have to do is copy one of the scripts in this page, plug your API key and your email variable, then use the verification results as you wish like shown in the code. Happy coding!

Javascript


var email = 'Email';
var key = 'Your API key';
$.ajax({
    url: 'https://api.verimail.io/v3/verify',
    method: 'POST',
    data:{email: email, key: key},   
    dataType: 'json',
    success: function(data) {
        console.log(data.status);   
        console.log(data.deliverable);
        console.log(data.result);  
        console.log(data.email);         
    }
});

PHP (cURL)


$email = 'Email';
$key = 'Your API key';
$ch = curl_init('https://api.verimail.io/v3/verify?email='.$email.'&key='.$key);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close($ch);
$validationResult = json_decode($json, true);
echo $validationResult['status'];
echo $validationResult['deliverable'];
echo $validationResult['result'];
echo $validationResult['email'];

Java (OkHttp)


import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.json.JSONObject;
public void veri(String email, String key) {
    //email is the email wich you want to check
    //key is your API key
    String url = "https://api.verimail.io/v3/verify?email="+email+"&key="+key;
    OkHttpClient client = new OkHttpClient().newBuilder().build();
    Request request = new Request.Builder().url(url).method("GET", null).build();
    Response response = client.newCall(request).execute();
    String resultat = response.body().string();
    JSONObject myObject = new JSONObject(resultat);
    System.out.println(myObject.getString("status"));
    System.out.println(myObject.getBoolean("deliverable"));
    System.out.println(myObject.getString("result"));
    System.out.println(myObject.getString("email"));
}

Python (HttpClient)


import http.client
import mimetypes
import json
conn = http.client.HTTPSConnection("api.verimail.io")
email = "Email"
key = "Your API key"
url =  '/v3/verify?email='+email+'&key='+key
conn.request("GET",url)
res = conn.getresponse()
datajs = res.read()
data = json.loads(datajs.decode("utf-8"))
print(data['status'])
print(data['deliverable'])
print(data['result'])
print(data['email'])