Please enable JavaScript in your browser.

Overview

This .NET library provides an easy way to call the MailboxValidator 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

Imports System.Text
Imports Microsoft.VisualStudio.TestTools.UnitTesting

 Public Class TestMailboxValidatorVB

     Public Sub TestMethod1()
        Dim mbv = New MailboxValidator.SingleValidation("PASTE_YOUR_API_KEY_HERE")
        Dim results As String = ""
        Try
            Dim rec = mbv.ValidateEmail("example@example.com")

            If rec.ErrorCode = "" Then
                results += "email_address: " & rec.EmailAddress & vbCrLf
                results += "domain: " & rec.Domain & vbCrLf
                results += "is_free: " & rec.IsFree & vbCrLf
                results += "is_syntax: " & rec.IsSyntax & vbCrLf
                results += "is_domain: " & rec.IsDomain & vbCrLf
                results += "is_smtp: " & rec.IsSMTP & vbCrLf
                results += "is_verified: " & rec.IsVerified & vbCrLf
                results += "is_server_down: " & rec.IsServerDown & vbCrLf
                results += "is_greylisted: " & rec.IsGreylisted & vbCrLf
                results += "is_disposable: " & rec.IsDisposable & vbCrLf
                results += "is_suppressed: " & rec.IsSuppressed & vbCrLf
                results += "is_role: " & rec.IsRole & vbCrLf
                results += "is_high_risk: " & rec.IsHighRisk & vbCrLf
                results += "is_catchall: " & rec.IsCatchall & vbCrLf
                results += "mailboxvalidator_score: " & rec.MailboxValidatorScore & vbCrLf
                results += "time_taken: " & rec.TimeTaken & vbCrLf
                results += "status: " & rec.Status & vbCrLf
                results += "credits_available: " & rec.CreditsAvailable & vbCrLf
            Else
                results += "error_code: " & rec.ErrorCode & vbCrLf
                results += "error_message: " & rec.ErrorMessage & vbCrLf
            End If

            results += "version: " & rec.Version & vbCrLf
            MsgBox(results)
        Catch ex As Exception
            MsgBox(ex.Message & vbCrLf & ex.StackTrace)
        End Try
    End Sub

End Class
						
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Windows.Forms;
using MailboxValidator;

namespace TestMailboxValidatorCSharp
{
    [TestClass]
    public class TestMailboxValidatorCSharp
    {
        [TestMethod]
        public void TestMethod1()
        {
            var mbv = new SingleValidation("PASTE_YOUR_API_KEY_HERE");
            String results = "";
            try
            {
                MBVResult rec = mbv.ValidateEmail("example@example.com");

                if (rec.ErrorCode == "")
                {
                    results += "email_address: " + rec.EmailAddress + "\n";
                    results += "domain: " + rec.Domain + "\n";
                    results += "is_free: " + rec.IsFree + "\n";
                    results += "is_syntax: " + rec.IsSyntax + "\n";
                    results += "is_domain: " + rec.IsDomain + "\n";
                    results += "is_smtp: " + rec.IsSMTP + "\n";
                    results += "is_verified: " + rec.IsVerified + "\n";
                    results += "is_server_down: " + rec.IsServerDown + "\n";
                    results += "is_greylisted: " + rec.IsGreylisted + "\n";
                    results += "is_disposable: " + rec.IsDisposable + "\n";
                    results += "is_suppressed: " + rec.IsSuppressed + "\n";
                    results += "is_role: " + rec.IsRole + "\n";
                    results += "is_high_risk: " + rec.IsHighRisk + "\n";
                    results += "is_catchall: " + rec.IsCatchall + "\n";
                    results += "mailboxvalidator_score: " + rec.MailboxValidatorScore + "\n";
                    results += "time_taken: " + rec.TimeTaken + "\n";
                    results += "status: " + rec.Status + "\n";
                    results += "credits_available: " + rec.CreditsAvailable + "\n";
                }
                else
                {
                    results += "error_code: " + rec.ErrorCode + "\n";
                    results += "error_message: " + rec.ErrorMessage + "\n";
                }

                results += "version: " + rec.Version + "\n";
                MessageBox.Show(results);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
            }
        }
    }
}