SDKs overview

MailboxValidator provides Software Development Kits (SDKs) and libraries to simplify interaction with its email validation API. These SDKs abstract the underlying HTTP requests and JSON parsing, allowing developers to integrate email verification functionalities using familiar language constructs. The official SDKs support several popular programming languages, providing a structured way to perform tasks such as validating single email addresses, checking email deliverability, and identifying common issues like disposable email providers or syntax errors.

Using an SDK can reduce the development effort required for integration compared to making raw HTTP requests, as the SDKs typically handle authentication, request formatting, and response parsing. This approach helps developers focus on their application's core logic rather than the specifics of API communication. MailboxValidator's API documentation details the various endpoints and parameters available for validation tasks, which the SDKs wrap for ease of use. For a comprehensive overview of the API's capabilities, developers can consult the MailboxValidator API documentation.

Official SDKs by language

MailboxValidator offers official SDKs for a range of programming languages, designed to provide a native development experience for integrating their email validation services. Each SDK is maintained to reflect the current API specifications and includes methods for common validation checks. The following table outlines the available official SDKs, their package names, installation commands, and typical maturity status.

Language Package Name Install Command Maturity
PHP mailboxvalidator/mailboxvalidator-php composer require mailboxvalidator/mailboxvalidator-php Stable
Python mailboxvalidator-python pip install mailboxvalidator-python Stable
Ruby mailboxvalidator gem install mailboxvalidator Stable
Java Maven artifact (details in docs) Add dependency to pom.xml Stable
C# MailboxValidator.API Install-Package MailboxValidator.API Stable
Node.js mailboxvalidator npm install mailboxvalidator Stable

Each SDK provides specific classes or functions to interact with the MailboxValidator API, such as validating an email address or retrieving a detailed report for an email. Developers can find detailed usage instructions and examples for each language in the MailboxValidator API documentation. For instance, the PHP SDK typically involves instantiating a client object with your API key and then calling a validation method, while the Python SDK offers similar object-oriented access to the API.

Installation

Installation procedures for MailboxValidator SDKs typically follow the standard package management practices for each respective language. Below are detailed installation steps for the PHP and Python SDKs, which are among the primary languages supported with examples.

PHP SDK Installation

The MailboxValidator PHP SDK is distributed via Composer, the dependency manager for PHP. To install it, you need to have Composer installed on your system. If not, follow the official Composer installation guide.

  1. Install Composer: If you don't have Composer, download and install it from the Composer download page.
  2. Navigate to your project directory: Open your terminal or command prompt and change the directory to your PHP project's root.
  3. Require the SDK: Run the following command to add the MailboxValidator PHP SDK to your project dependencies:
    composer require mailboxvalidator/mailboxvalidator-php
    This command downloads the SDK and its dependencies, and adds them to your vendor/ directory and composer.json file.
  4. Include the autoloader: In your PHP script, include Composer's autoloader to make the SDK classes available:
    <?php
    require 'vendor/autoload.php';
    // Your application code here
    ?>

Python SDK Installation

The MailboxValidator Python SDK is available through pip, the package installer for Python. Ensure you have pip installed, which typically comes bundled with Python installations from version 3.4 onwards. For older Python versions or if pip is missing, refer to the pip installation instructions.

  1. Install pip (if needed): Most modern Python installations include pip. You can check by running pip --version. If not found, install pip using the recommended methods.
  2. Install the SDK: Open your terminal or command prompt and execute the following command:
    pip install mailboxvalidator-python
    This command fetches the Python SDK package from the Python Package Index (PyPI) and installs it into your Python environment.
  3. Import in your script: In your Python code, you can then import the necessary classes or functions:
    from mailboxvalidator import MailboxValidator
    # Your application code here

Other Languages

For Ruby, the SDK is installed via RubyGems: gem install mailboxvalidator. For Java, developers typically add a Maven or Gradle dependency to their project's build file. For C#, the SDK is available as a NuGet package, installed using Install-Package MailboxValidator.API in the Package Manager Console. Node.js users can install via npm: npm install mailboxvalidator. Specific instructions for each language, including dependency declarations and project setup, are detailed in the respective sections of the MailboxValidator API documentation.

Quickstart example

This quickstart demonstrates how to perform a basic email validation using the MailboxValidator Python SDK. This example assumes you have already installed the Python SDK as described in the installation section and have an API key from MailboxValidator.

Prerequisites:

  • Python 3.x installed
  • MailboxValidator Python SDK installed (pip install mailboxvalidator-python)
  • A valid MailboxValidator API key (obtainable from your MailboxValidator account dashboard)

Python Quickstart Code:

from mailboxvalidator import MailboxValidator

# Replace 'YOUR_API_KEY' with your actual MailboxValidator API key
API_KEY = 'YOUR_API_KEY'

# Initialize the MailboxValidator client
mv = MailboxValidator(API_KEY)

# Email address to validate
email_to_validate = '[email protected]'

# Perform the validation
response = mv.validate_email(email_to_validate)

# Check if the validation was successful and print results
if response and response['status'] == 'True':
    print(f"Validation for {email_to_validate}:")
    print(f"  Is Valid: {response['is_valid']}")
    print(f"  Disposable: {response['is_disposable']}")
    print(f"  Free Email: {response['is_free']}")
    print(f"  Syntax Check: {response['syntax_check']}")
    print(f"  DNS Check: {response['dns_check']}")
    print(f"  SMTP Check: {response['smtp_check']}")
    print(f"  Reason: {response['reason']}")
    print(f"  Suggestion: {response['suggestion']}")
else:
    print(f"Error validating {email_to_validate}: {response.get('error_message', 'Unknown error')}")

Explanation:

  1. from mailboxvalidator import MailboxValidator: Imports the necessary class from the installed SDK.
  2. API_KEY = 'YOUR_API_KEY': Sets your MailboxValidator API key. This key authenticates your requests to the API.
  3. mv = MailboxValidator(API_KEY): Creates an instance of the MailboxValidator client, passing your API key for authentication.
  4. email_to_validate = '[email protected]': Defines the email address you wish to validate.
  5. response = mv.validate_email(email_to_validate): Calls the validate_email method on the client instance, passing the email address. This method makes the API call and returns a dictionary containing the validation results.
  6. The subsequent if/else block checks the status field of the response to determine if the API call was successful. If successful, it prints various details about the email's validity, deliverability, and other attributes such as whether it's a disposable or free email service. Error messages are printed if the validation fails.

For more advanced usage, including bulk validation or specific error handling, refer to the detailed MailboxValidator API and SDK documentation.

Community libraries

While MailboxValidator primarily promotes its official SDKs, the API's RESTful nature allows for integration using any HTTP client library in virtually any programming language. Community-contributed libraries might emerge for niche use cases or specific frameworks, offering alternative abstractions or integrations. However, developers should be aware that community-maintained libraries may not always keep pace with API updates or may lack the official support and guarantees provided by MailboxValidator's own SDKs. When considering a community library, it is advisable to check its maintenance status, documentation, and community activity to ensure it is suitable for production use.

These community efforts often leverage standard HTTP/REST client libraries, such as requests in Python, axios in Node.js, or Guzzle in PHP, to interact with the MailboxValidator API endpoints. For example, a developer might choose to write a custom wrapper around the API for a specific framework like Django or Ruby on Rails if an official, framework-specific SDK is not available. The core principles of interacting with a REST API, as outlined by standards like W3C REST architecture principles, remain consistent whether using an official SDK or a custom HTTP client.

Developers who opt for direct API integration without an official SDK should refer to the MailboxValidator API reference for precise endpoint URLs, request methods, required parameters, and expected response formats. This ensures correct implementation and compatibility with the service, regardless of the client library used.