Avoid Fake Emails in Your Database: As a webmaster, you never want your emails to be sent to fake IDs. Spam will skyrocket and the deliverability rate of your emails will plummet if this happens. One should always take care to verify their email addresses before using them for email marketing. Luckily we integrate with the amazing API, known as Mailboxlayer that helps keep our database safe from such misuse and allows us not to take any chances when it comes to improving deliverability and keeping our customers happy by ensuring that only genuine recipients get our messages!
What is Mailboxlayer API?
Mailboxlayer is a simple REST API for validating the deliverability and quality of the email addresses available in your database. This API helps you to verify the email IDs quickly by checking syntax, typos and spelling. It also utilizes a variety of technologies including SMTP checks and disposable provider filtering, to eliminate fake addresses.
Why Should You Use Mailboxlayer API?
- It enables you to verify of all the emails available in database.
- It’s lightweight, fast and it’s easy to use.
- It also provides high-level security via 256-bit HTTPS encryption.
How Can Mailboxlayer API Help You With Validating Email Addresses?
Checking Bulk Email Address
Mailboxlayer is a service that makes it easy to verify multiple email addresses at once. Just paste a list of comma-separated email addresses into the service’s URL and Mailboxlayer will immediately return whether each address can exist or not.
https://apilayer.net/api/check ? access_key = YOUR_ACCESS_KEY & email = support@apilayer.com, support1@apilayer.com, support2@mailboxlayer.com, … |
As we recently discovered, Mailboxlayer has made it convenient for people to identify and eliminate duplicate email addresses using simple and efficient search options.
Checking Syntax
{ […] “format_valid”: true, […] } |
Performing Real-Time Verification
When you request a user’s email address, Mailboxlayer first verifies whether the address is valid by checking whether an MX record is configured or if not, by sending them a verification email. If everything checks out fine, it returns the following JSON response:
{ […] “mx_found”: true, […] } |
Next, Mailboxlayer performs the SMTP check to find out whether the email address actually exists or not. The following JSON response comes if it exists.
{ […] “smtp_check”: true, […] } |
Checking Disposable Email Provider
{ […] “disposable”: true, […] } |
Assigning Quality Score
After the validation process is performed, Mailboxlayer shows a numeric Quality score ranging from 0 to 1. Here is the example:
{ […] “score”: 0.8 } |
If the score is 0.8, the email quality is very good. It means the Email ID is real. The email insight info helps to determine the quality of this contact data in your system even if they’re using disposable temporary addresses.
How to Verify the Email Address With Mailboxlayer API?
What makes Mailbox Layer API so valuable is that you can easily set it up with just a few lines of code. You just need to follow these steps:
Verifying Email Address Using PHP
1. The first step is to register at Mailboxlayer’s official website and obtain the API access key.
2. In the next step you have to set the API access key.
$access_key = ‘YOUR_ACCESS_KEY’; |
3. Set the email address now.
$email_address = ‘support@apilayer.com’; |
4. Now 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. In the next step, you need to store the JSON data in a variable, called $json. You also need 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. In this final step you need to validate 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 = ‘support@apilayer.com’; // 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. In the first step, you have to set the API access key.
var access_key = ‘YOUR_ACCESS_KEY’; |
2. After the first step you have to set the email address.
var email_address = ‘support@apilayer.com’; |
3. You can now verify the email address through 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 = ‘support@apilayer.com’; // 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 is a wonderful product. It works just as well as it says it does and is unlike other products in the same class, and we highly recommend it for any developer or business seeking to improve their email verifications and open rates.
Spread the love