Please enable JavaScript in your browser.

Overview

This .NET library provides an easy way to call the MailboxValidator Email Validation API which validates if an email address is a valid one.

NOTE: An API key will be given to you when you signup for any of our API plans. This library will require that API key to function.


Installation via NuGet Package Manager

Install-Package MailboxValidator.SingleValidation

Sample Codes

To validate an email address
Imports Newtonsoft.Json

Module Program
    Sub Main(args As String())
        Dim apikey = "PASTE_YOUR_API_KEY_HERE"
        Dim email = "example@example.com"
        Dim mbv As New MailboxValidator.SingleValidation(apikey)

        Dim mytask = mbv.ValidateEmailAsync(email) ' async API Call
        Dim myobj = mytask.Result

        Console.WriteLine(JsonConvert.SerializeObject(myobj, Formatting.Indented)) ' to pretty-print the JSON

        Console.WriteLine("email_address:" & myobj("email_address").ToString)
        Console.WriteLine("domain:" & myobj("domain").ToString)
        Console.WriteLine("is_free:" & myobj("is_free").ToString)
        Console.WriteLine("is_syntax:" & myobj("is_syntax").ToString)
        Console.WriteLine("is_domain:" & myobj("is_domain").ToString)
        Console.WriteLine("is_smtp:" & myobj("is_smtp").ToString)
        Console.WriteLine("is_verified:" & myobj("is_verified").ToString)
        Console.WriteLine("is_server_down:" & myobj("is_server_down").ToString)
        Console.WriteLine("is_greylisted:" & myobj("is_greylisted").ToString)
        Console.WriteLine("is_disposable:" & myobj("is_disposable").ToString)
        Console.WriteLine("is_suppressed:" & myobj("is_suppressed").ToString)
        Console.WriteLine("is_role:" & myobj("is_role").ToString)
        Console.WriteLine("is_high_risk:" & myobj("is_high_risk").ToString)
        Console.WriteLine("is_catchall:" & myobj("is_catchall").ToString)
        Console.WriteLine("mailboxvalidator_score:" & myobj("mailboxvalidator_score").ToString)
        Console.WriteLine("time_taken:" & myobj("time_taken").ToString)
        Console.WriteLine("status:" & myobj("status").ToString)
        Console.WriteLine("credits_available:" & myobj("credits_available").ToString)
    End Sub
End Module

To check if an email is from a disposable email provider
Imports Newtonsoft.Json

Module Program
    Sub Main(args As String())
        Dim apikey = "PASTE_YOUR_API_KEY_HERE"
        Dim email = "example@example.com"
        Dim mbv As New MailboxValidator.SingleValidation(apikey)

        Dim mytask = mbv.DisposableEmailAsync(email) ' async API Call
        Dim myobj = mytask.Result

        Console.WriteLine(JsonConvert.SerializeObject(myobj, Formatting.Indented)) ' to pretty-print the JSON

        Console.WriteLine("email_address:" & myobj("email_address").ToString)
        Console.WriteLine("is_disposable:" & myobj("is_disposable").ToString)
        Console.WriteLine("credits_available:" & myobj("credits_available").ToString)
    End Sub
End Module

To check if an email is from a free email provider
Imports Newtonsoft.Json

Module Program
    Sub Main(args As String())
        Dim apikey = "PASTE_YOUR_API_KEY_HERE"
        Dim email = "example@example.com"
        Dim mbv As New MailboxValidator.SingleValidation(apikey)

        Dim mytask = mbv.FreeEmailAsync(email) ' async API Call
        Dim myobj = mytask.Result

        Console.WriteLine(JsonConvert.SerializeObject(myobj, Formatting.Indented)) ' to pretty-print the JSON

        Console.WriteLine("email_address:" & myobj("email_address").ToString)
        Console.WriteLine("is_free:" & myobj("is_free").ToString)
        Console.WriteLine("credits_available:" & myobj("credits_available").ToString)
    End Sub
End Module
To validate an email address
using Newtonsoft.Json;
using MailboxValidator;

var apikey = "PASTE_YOUR_API_KEY_HERE";
var email = "example@example.com";
SingleValidation mbv = new SingleValidation(apikey);

var mytask = mbv.ValidateEmailAsync(email); // async API Call
var myobj = mytask.Result;

Console.WriteLine(JsonConvert.SerializeObject(myobj, Formatting.Indented)); // to pretty-print the JSON

Console.WriteLine("email_address:" + myobj["email_address"].ToString());
Console.WriteLine("domain:" + myobj["domain"].ToString());
Console.WriteLine("is_free:" + myobj["is_free"].ToString());
Console.WriteLine("is_syntax:" + myobj["is_syntax"].ToString());
Console.WriteLine("is_domain:" + myobj["is_domain"].ToString());
Console.WriteLine("is_smtp:" + myobj["is_smtp"].ToString());
Console.WriteLine("is_verified:" + myobj["is_verified"].ToString());
Console.WriteLine("is_server_down:" + myobj["is_server_down"].ToString());
Console.WriteLine("is_greylisted:" + myobj["is_greylisted"].ToString());
Console.WriteLine("is_disposable:" + myobj["is_disposable"].ToString());
Console.WriteLine("is_suppressed:" + myobj["is_suppressed"].ToString());
Console.WriteLine("is_role:" + myobj["is_role"].ToString());
Console.WriteLine("is_high_risk:" + myobj["is_high_risk"].ToString());
Console.WriteLine("is_catchall:" + myobj["is_catchall"].ToString());
Console.WriteLine("mailboxvalidator_score:" + myobj["mailboxvalidator_score"].ToString());
Console.WriteLine("time_taken:" + myobj["time_taken"].ToString());
Console.WriteLine("status:" + myobj["status"].ToString());
Console.WriteLine("credits_available:" + myobj["credits_available"].ToString());

To check if an email is from a disposable email provider
using Newtonsoft.Json;
using MailboxValidator;

var apikey = "PASTE_YOUR_API_KEY_HERE";
var email = "example@example.com";
SingleValidation mbv = new SingleValidation(apikey);

var mytask = mbv.DisposableEmailAsync(email); // async API Call
var myobj = mytask.Result;

Console.WriteLine(JsonConvert.SerializeObject(myobj, Formatting.Indented)); // to pretty-print the JSON

Console.WriteLine("email_address:" + myobj["email_address"].ToString());
Console.WriteLine("is_disposable:" + myobj["is_disposable"].ToString());
Console.WriteLine("credits_available:" + myobj["credits_available"].ToString());

To check if an email is from a free email provider
using Newtonsoft.Json;
using MailboxValidator;

var apikey = "PASTE_YOUR_API_KEY_HERE";
var email = "example@example.com";
SingleValidation mbv = new SingleValidation(apikey);

var mytask = mbv.FreeEmailAsync(email); // async API Call
var myobj = mytask.Result;

Console.WriteLine(JsonConvert.SerializeObject(myobj, Formatting.Indented)); // to pretty-print the JSON

Console.WriteLine("email_address:" + myobj["email_address"].ToString());
Console.WriteLine("is_free:" + myobj["is_free"].ToString());
Console.WriteLine("credits_available:" + myobj["credits_available"].ToString());

Related Videos