Quickstart#

Dependencies#

An API key is required for this module to function.

Go to https://www.mailboxvalidator.com/plans#api to sign up for FREE API plan and you’ll be given an API key.

Requirements#

Intellij IDEA: https://www.jetbrains.com/idea/

Sample Codes#

Validate email#

You can validate whether an email address is invalid or not as below:

object Main {
    @JvmStatic
    fun main(args: Array<String>) {
        try {
            val mbv = SingleValidation("PASTE_YOUR_API_KEY_HERE")

            val rec: MBVResult = mbv.validateEmail("example@example.com")

            if (rec.errorMessage == null) {
                println("email_address: " + rec.emailAddress)
                println("domain: " + rec.domainName)
                println("is_free: " + rec.isFree)
                println("is_syntax: " + rec.isSyntax)
                println("is_domain: " + rec.isDomain)
                println("is_smtp: " + rec.isSMTP)
                println("is_verified: " + rec.isVerified)
                println("is_server_down: " + rec.isServerDown)
                println("is_greylisted: " + rec.isGreylisted)
                println("is_disposable: " + rec.isDisposable)
                println("is_suppressed: " + rec.isSuppressed)
                println("is_role: " + rec.isRole)
                println("is_high_risk: " + rec.isHighRisk)
                println("is_catchall: " + rec.isCatchall)
                println("is_dmarc_enforced: " + rec.isDMARCEnforced)
                println("is_strict_spf: " + rec.isStrictSPF)
                println("website_exist: " + rec.websiteExist)
                println("mailboxvalidator_score: " + rec.mailboxValidatorScore)
                println("time_taken: " + rec.timeTaken)
                println("status: " + rec.status)
                println("credits_available: " + rec.creditsAvailable)
            } else {
                println("error_code: " + rec.errorCode)
                println("error_message: " + rec.errorMessage)
            }
            println("version: " + rec.version)
        } catch (e: java.lang.Exception) {
            e.printStackTrace(System.out)
        }
    }
}

Check if an email is from a disposable email provider#

You can validate whether an email address is disposable email address or not as below:

object Main {
    @JvmStatic
    fun main(args: Array<String>) {
        try {
            val mbv = SingleValidation("PASTE_YOUR_API_KEY_HERE")

            val rec: MBVResult = mbv.disposableEmail("example@example.com")

            if (rec.errorMessage == null) {
                println("email_address: " + rec.emailAddress)
                println("is_disposable: " + rec.isDisposable)
                println("credits_available: " + rec.creditsAvailable)
            } else {
                println("error_code: " + rec.errorCode)
                println("error_message: " + rec.errorMessage)
            }
            println("version: " + rec.version)
        } catch (e: java.lang.Exception) {
            e.printStackTrace(System.out)
        }
    }
}

Check if an email is from a free email provider#

You can validate whether an email address is free email address or not as below:

object Main {
    @JvmStatic
    fun main(args: Array<String>) {
        try {
            val mbv = SingleValidation("PASTE_YOUR_API_KEY_HERE")

            val rec: MBVResult = mbv.freeEmail("example@example.com")

            if (rec.errorMessage == null) {
                println("email_address: " + rec.emailAddress)
                println("is_free: " + rec.isFree)
                println("credits_available: " + rec.creditsAvailable)
            } else {
                println("error_code: " + rec.errorCode)
                println("error_message: " + rec.errorMessage)
            }
            println("version: " + rec.version)
        } catch (e: java.lang.Exception) {
            e.printStackTrace(System.out)
        }
    }
}