How to Avoid Fake Emails in Your Database?

This article is sponsored by Apilayer

Tweet
Share
WhatsApp

As a webmaster, you never want your emails to be sent to fake IDs. It will increase the spam score of your email address. As a result, all of your emails will end up in the recipient’s spam folder. It will drastically reduce the open rates and significantly increase the bounce rates. So, your email marketing campaign will fail miserably. That’s why it’s very important to verify all the email IDs in your database to identify and eliminate the fake ones. In this post, you will know the details of avoiding fake email addresses by utilizing an amazing API, known as Mailboxlayer. 

What is Mailboxlayer API?

Mailboxlayer is a simple REST API for validating the deliverability and quality of the email addresses in your database. It enables you to verify the email IDs quickly by checking syntax, typos, and spelling. Also, it utilizes a variety of technologies, including SMTP checks and disposable provider filtering, to eliminate fake addresses.

Why should you use Mailboxlayer API?

  • Enables you to verify all the email addresses on your database
  • Lightweight, fast, and easy to use
  • Provides high-level security through 256-bit HTTPS encryption

How can Mailboxlayer API help you with validating email addresses?

Checking Bulk Email Address

Mailboxlayer helps you to validate bulk email addresses quickly. You just need to append multiple comma-separated email addresses to the API’s base URL.

https://apilayer.net/api/check
                ? access_key = YOUR_ACCESS_KEY
                & email = [email protected], [email protected],
                [email protected], …

As you can see, Mailboxlayer has made the process of bulk email address validation pretty simple. So, you can eliminate fake IDs quickly and conveniently. 

Checking Syntax

Mailboxlayer performs a standard syntax check to verify the compliance of email addresses with regular expression rules. Let’s think that the standard format of the email ID is [email protected] Here, the “local-part” may be up to 64 characters long. On the other hand, the domain name may have a maximum of 253 characters. If Mailboxlayer finds that the syntax is OK, it will return the following JSON response:

{
  […]
  “format_valid”: true,
  […]
}

Performing Real-Time Verification

Mailboxlayer verifies the email addresses in real-time by detecting whether the requested domain is configured to receive email or not. If everything is fine, it returns the following JSON response:

{
  […]
  “mx_found”: true,
  […]
}

Next, Mailboxlayer performs the SMTP check to determine whether the email address actually exists or not. If it exists, you will see the following JSON response:

{
  […]
  “smtp_check”: true,
  […]
}

Checking Disposable Email Provider 

Disposable email provider refers to the service that allows users to create a temporary email address anonymously. They expired after a certain period. They are often used for only activating accounts or receiving passwords. Also, there are a lot of disposable email providers that do not require the users to sign up. This type of one-time email ID is often used to create fake accounts. So, it’s very important to identify the addresses of the disposable email provider. 

When Mailboxlayer API detects an ID from the disposable email provider, like mailinator.com or trashmail.com, it returns the following JSON response:

{
  […]
  “disposable”: true,
  […]
}

Assigning Quality Score

After performing the validation process, Mailboxlayer returns a numeric Quality score ranging from 0 to 1. Here is an example:

{
  […]
  “score”: 0.8
}

As the score is 0.8, the quality of the email address is very good. It ensures that the ID is real. The information helps you to determine the email address quality in your database effectively. 

How to verify the email address with Mailboxlayer API?

Mailboxlayer API is very easy to use. With just a few lines of code, you can verify email addresses quickly. You just need to follow these steps:

Verifying Email Address Using PHP

1. First, you have to register at Mailboxlayer’s website and obtain the API access key.

2. Then you have to set the API access key.

$access_key = ‘YOUR_ACCESS_KEY’;

3. Now, you have to set the email address.

$email_address = ‘[email protected]’;

4. Then you have to initialize CURL. 

$ch = curl_init(‘http://apilayer.net/api/check?access_key=’.$access_key.’&email=’.$email_address.”); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

5. Next, you have to store the JSON data in a variable, called $json. Also, you have to close the CURL session.

$json = curl_exec($ch);
curl_close($ch);

6. Now, you can decode JSON response:

$validationResult = json_decode($json, true);

7. Finally, it’s time for validating the email address. You can use a variety of validation result objects, including format_valid, smtp_check, and score.

$validationResult[‘format_valid’];
$validationResult[‘smtp_check’];
$validationResult[‘score’];

Overall, the code will look like this:

// set API Access Key
$access_key = ‘YOUR_ACCESS_KEY’;

// set email address
$email_address = ‘[email protected]’;

// Initialize CURL:
$ch = curl_init(‘http://apilayer.net/api/check?access_key=’.$access_key.’&email=’.$email_address.”); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Store the data:
$json = curl_exec($ch);
curl_close($ch);

// Decode JSON response:
$validationResult = json_decode($json, true);

// Access and use your preferred validation result objects
$validationResult[‘format_valid’];
$validationResult[‘smtp_check’];
$validationResult[‘score’];

Verifying Email Address Using JavaScript

1. First, you have to set the API access key.

var access_key = ‘YOUR_ACCESS_KEY’;

2. Then you have to set the email address.

var email_address = ‘[email protected]’;

3. Now, you can verify the email address via AJAX call. You can print the validation result by using the console.log() function.

// verify email address via AJAX call
$.ajax({
    url: ‘http://apilayer.net/api/check?access_key=’ + access_key + ‘&email=’ + email_address,  
    dataType: ‘jsonp’,
    success: function(json) {

    // Access and use your preferred validation result objects
    console.log(json.format_valid);
    console.log(json.smtp_check);
    console.log(json.score);

    }
});

Overall, the code will look like this:

// set endpoint and your access key
var access_key = ‘YOUR_ACCESS_KEY’;
var email_address = ‘[email protected]’;

// verify email address via AJAX call
$.ajax({
    url: ‘http://apilayer.net/api/check?access_key=’ + access_key + ‘&email=’ + email_address,  
    dataType: ‘jsonp’,
    success: function(json) {

    // Access and use your preferred validation result objects
    console.log(json.format_valid);
    console.log(json.smtp_check);
    console.log(json.score);

    }
});

Should I really use the Mailboxlayer API?

Mailboxlayer API boasts powerful email validation and verification features. It can increase open rates and decrease bounce rates significantly. Also, it is lightweight, fast, and very easy to use. So, you should definitely consider using it. 

Mailboxlayer is a simple REST API that helps you to identify the fake emails on your database. Try it now for free.

Partner Content

Partner Content

Fossbytes caters to a vast and influential readership spread all across the world. Get your brand in front of millions of readers with our specially-crafted and attractive sponsored posts. To learn more, read our sponsored post guidelines.
More From Fossbytes

Latest On Fossbytes

Find your dream job