Please enable JavaScript in your browser.

Overview

This Perl module 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 module will require that API key to function.


Installation

Run the following commands to install the MailboxValidator Perl Module manually.
perl Makefile.PL
make
make test
make install
Or, run the cpan command to install the MailboxValidator Perl Module.
cpan install MailboxValidator::SingleValidation

Sample Codes

To validate an email address
use MailboxValidator::SingleValidation;

my $mbv = MailboxValidator::SingleValidation->Init('PASTE_YOUR_API_KEY_HERE');

my $results = $mbv->ValidateEmail('example@example.com');

if (!defined($results))
{
	print "Error connecting to API.\n";
}
elsif ($results->{error_code} eq '')
{
	print 'email_address = ' . $results->{email_address} . "\n";
	print 'domain = ' . $results->{domain} . "\n";
	print 'is_free = ' . $results->{is_free} . "\n";
	print 'is_syntax = ' . $results->{is_syntax} . "\n";
	print 'is_domain = ' . $results->{is_domain} . "\n";
	print 'is_smtp = ' . $results->{is_smtp} . "\n";
	print 'is_verified = ' . $results->{is_verified} . "\n";
	print 'is_server_down = ' . $results->{is_server_down} . "\n";
	print 'is_greylisted = ' . $results->{is_greylisted} . "\n";
	print 'is_disposable = ' . $results->{is_disposable} . "\n";
	print 'is_suppressed = ' . $results->{is_suppressed} . "\n";
	print 'is_role = ' . $results->{is_role} . "\n";
	print 'is_high_risk = ' . $results->{is_high_risk} . "\n";
	print 'is_catchall = ' . $results->{is_catchall} . "\n";
	print 'mailboxvalidator_score = ' . $results->{mailboxvalidator_score} . "\n";
	print 'time_taken = ' . $results->{time_taken} . "\n";
	print 'status = ' . $results->{status} . "\n";
	print 'credits_available = ' . $results->{credits_available} . "\n";
}
else
{
	print 'error_code = ' . $results->{error_code} . "\n";
	print 'error_message = ' . $results->{error_message} . "\n";
}

To check if an email is from a disposable email provider
use MailboxValidator::SingleValidation;

my $mbv = MailboxValidator::SingleValidation->Init('PASTE_YOUR_API_KEY_HERE');

my $results = $mbv->DisposableEmail('example@example.com');

if (!defined($results))
{
	print "Error connecting to API.\n";
}
elsif ($results->{error_code} eq '')
{
	print 'email_address = ' . $results->{email_address} . "\n";
	print 'is_disposable = ' . $results->{is_disposable} . "\n";
	print 'credits_available = ' . $results->{credits_available} . "\n";
}
else
{
	print 'error_code = ' . $results->{error_code} . "\n";
	print 'error_message = ' . $results->{error_message} . "\n";
}

To check if an email is from a free email provider
use MailboxValidator::SingleValidation;

my $mbv = MailboxValidator::SingleValidation->Init('PASTE_YOUR_API_KEY_HERE');

my $results = $mbv->FreeEmail('example@example.com');

if (!defined($results))
{
	print "Error connecting to API.\n";
}
elsif ($results->{error_code} eq '')
{
	print 'email_address = ' . $results->{email_address} . "\n";
	print 'is_free = ' . $results->{is_free} . "\n";
	print 'credits_available = ' . $results->{credits_available} . "\n";
}
else
{
	print 'error_code = ' . $results->{error_code} . "\n";
	print 'error_message = ' . $results->{error_message} . "\n";
}

Related Videos