MailboxValidator Rust package

This Rust package enables user to easily validate if an email address is valid, a type of disposable email or free email.

This module can be useful in many types of projects, for example

Installation

Just add mailboxvalidator = "1.0.0" into your Cargo.toml.

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.

Functions

validateemail(emailaddress)

Performs email validation on the supplied email address.

Return Fields

| Field Name | Description | | ---------------------- | ------------------------------------------------------------ | | emailaddress | The input email address. | | domain | The domain of the email address. | | isfree | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: True, False | | issyntax | Whether the email address is syntactically correct. Return values: True, False | | isdomain | Whether the email address has a valid MX record in its DNS entries. Return values: True, False, - (- means not applicable) | | issmtp | Whether the mail servers specified in the MX records are responding to connections. Return values: True, False, - (- means not applicable) | | isverified | Whether the mail server confirms that the email address actually exist. Return values: True, False, - (- means not applicable) | | isserverdown | Whether the mail server is currently down or unresponsive. Return values: True, False, - (- means not applicable) | | isgreylisted | Whether the mail server employs greylisting where an email has to be sent a second time at a later time. Return values: True, False, - (- means not applicable) | | isdisposable | Whether the email address is a temporary one from a disposable email provider. Return values: True, False, - (- means not applicable) | | issuppressed | Whether the email address is in our blacklist. Return values: True, False, - (- means not applicable) | | isrole | Whether the email address is a role-based email address like admin@example.net or webmaster@example.net. Return values: True, False, - (- means not applicable) | | ishighrisk | Whether the email address contains high risk keywords. Return values: True, False, - (- means not applicable) | | iscatchall | Whether the email address is a catch-all address. Return values: True, False, Unknown, - (- means not applicable) | | mailboxvalidatorscore | Email address reputation score. Score > 0.70 means good; score > 0.40 means fair; score <= 0.40 means poor. | | timetaken | The time taken to get the results in seconds. | | status | Whether our system think the email address is valid based on all the previous fields. Return values: True, False | | creditsavailable | The number of credits left to perform validations. | | errorcode | The error code if there is any error. See error table in the below section. | | errormessage | The error message if there is any error. See error table in the below section. |

isdisposableemail(email_address)

Check if the supplied email address is from a disposable email provider.

Return Fields

| Field Name | Description | | ----------------- | ------------------------------------------------------------ | | emailaddress | The input email address. | | isdisposable | Whether the email address is a temporary one from a disposable email provider. Return values: True, False | | creditsavailable | The number of credits left to perform validations. | | errorcode | The error code if there is any error. See error table in the below section. | | error_message | The error message if there is any error. See error table in the below section. |

isfreeemail(email_address)

Check if the supplied email address is from a free email provider.

Return Fields

| Field Name | Description | | ----------------- | ------------------------------------------------------------ | | emailaddress | The input email address. | | isfree | Whether the email address is from a free email provider like Gmail or Hotmail. Return values: True, False | | creditsavailable | The number of credits left to perform validations. | | errorcode | The error code if there is any error. See error table in the below section. | | error_message | The error message if there is any error. See error table below. |

Sample Codes

Validate email

```rust use mailboxvalidator;

let validationresult = mailboxvalidator::validateemail("example@example.com",PASTEAPIKEY_HERE);

match validationresult { Ok(num) => { let okresult = num; asserteq!(okresult["status"], "False"); asserteq!(okresult["error_code"], ""); }, Err(err) => println!("{:#?}", err), }; ```

Check if an email is from a disposable email provider

```rust use mailboxvalidator;

let validationresult = mailboxvalidator::isdisposableemail("example@example.com",PASTEAPIKEYHERE);

match validationresult { Ok(num) => { let okresult = num; asserteq!(okresult["isdisposable"], "True"); asserteq!(okresult["errorcode"], ""); }, Err(err) => println!("{:#?}", err), }; ```

Check if an email is from a free email provider

```rust use mailboxvalidator;

let validationresult = mailboxvalidator::isfreeemail("example@example.com",PASTEAPIKEYHERE);

match validationresult { Ok(num) => { let okresult = num; asserteq!(okresult["isfree"], "False"); asserteq!(okresult["errorcode"], ""); }, Err(err) => println!("{:#?}", err), }; ```

Errors

| errorcode | errormessage | | ---------- | --------------------- | | 100 | Missing parameter. | | 101 | API key not found. | | 102 | API key disabled. | | 103 | API key expired. | | 104 | Insufficient credits. | | 105 | Unknown error. |

Copyright

Copyright (C) 2018-2021 by MailboxValidator.com, support@mailboxvalidator.com