Home Unlimited API FAQ GitBook Contact Menu  Review us on

REST API

We understand the importance of integrating our email verification solution seamlessly into your existing systems. That's why we offer a robust REST API that allows you to easily integrate our email verification capabilities into any other solution.

Upgrading to the unlimited version of MailTester.ninja offers high speed access to the REST API, allowing you to automate your email address verification process and improve efficiency.

MailTester Ninja REST API

Method

					GET
				

Authentication Token

Your unlimited key without {}

					https://token.mailtester.ninja/token?key=yourkey
				

Token Response

					{
"product":"E",
"token":"Mk5ETGRlQnd3WkZYOGszWXlwQV...WDhQR0pJU0tLa1R4WW5BbXRJVA==",
"message":"Your key is enabled: {sub_.....O3gC6}",
"portal":"7sI7....cMbII"
}
				

API endpoint

					https://happy.mailtester.ninja/ninja
				

Parameters

The email address you are verifying: email (required)

Your authentication token: token (required) (valid 24h)

					https://happy.mailtester.ninja/ninja?email=john.doe@email.com&token=yourtoken
				

API Response

					{
	"email": "john.doe@email.com",
	"user": "John Doe",
	"domain": "email.com",
	"mx": "mx.sender-email.com",
	"code": "ok",
	"message": "Accepted",
	"api": 5,
	"connections": 1
}
				

Our API is designed to be simple and intuitive, allowing you to quickly and easily verify email addresses without any complex coding or setup.

With our API, you can streamline your email verification process, improve your communication strategy, and reduce bounce rates, all while maintaining the security and privacy of your data.

The free version of the API without a key is limited to verifying 1 email per minute. For the unlimited version with a key, the rate limit is 3 emails every 2 seconds, allowing for much faster and more efficient email verification.

So, whether you're looking to integrate email verification into your CRM, email marketing tool, or any other solution, our API makes it easy to get started. Sign up today and start using our advanced email verification tools to take your communication strategy to the next level.

How to Use the Email Verification API with Node.js

Follow the steps below to integrate your email verification API with Node.js and verify a list of email addresses.

Node.js Script (server.js)

	const axios = require('axios');
const express = require('express');
const app = express();
const port = 3000;

const apiToken = 'yourtoken'; // Replace with your token
const apiUrl = 'https://happy.mailtester.ninja';

const emailList = [
    'john.doe@email.com',
    'jane.doe@email.com',
    'invalid.email@domain.com'
];

app.get('/', async (req, res) => {
    let results = await verifyEmailList(emailList);
    res.send(generateHtml(results));
});

async function verifyEmailList(emailList) {
    let results = [];
    for (let email of emailList) {
        try {
            let response = await axios.get(apiUrl, {
                params: {
                    email: email,
                    key: apiKey
                }
            });
            results.push(response.data);
        } catch (error) {
            results.push({ email: email, error: error.message });
        }
    }
    return results;
}

function generateHtml(results) {
    let html = `
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Email Verification Results</title>
        <style>
            table {
                width: 100%;
                border-collapse: collapse;
            }
            th, td {
                border: 1px solid #ddd;
                padding: 8px;
                text-align: left;
            }
            th {
                background-color: #f2f2f2;
            }
        </style>
    </head>
    <body>
        <h1>Email Verification Results</h1>
        <table>
            <thead>
                <tr>
                    <th>Email</th>
                    <th>User</th>
                    <th>Domain</th>
                    <th>MX</th>
                    <th>Code</th>
                    <th>Message</th>
                </tr>
            </thead>
            <tbody>
    `;

    results.forEach(result => {
        html += `
            <tr>
                <td>${result.email}</td>
                <td>${result.user || 'N/A'}</td>
                <td>${result.domain || 'N/A'}</td>
                <td>${result.mx || 'N/A'}</td>
                <td>${result.code || 'N/A'}</td>
                <td>${result.message || 'N/A'}</td>
            </tr>
        `;
    });

    html += `
            </tbody>
        </table>
    </body>
    </html>
    `;
    return html;
}

app.listen(port, () => {
    console.log(`Server running at http://localhost:${port}`);
});

Installation and Execution Instructions

Follow these steps to install and run the Node.js script:

  1. Install Node.js and npm: Make sure you have Node.js and npm installed on your machine. You can download them from nodejs.org.
  2. Create a Node.js project:

    mkdir email-verification
    cd email-verification
    npm init -y
  3. Install the necessary dependencies:

    npm install axios express
  4. Create the server.js file and paste the code above.
  5. Run the server:

    node server.js
  6. Access the application: Open your browser and go to http://localhost:3000.

This Node.js script verifies a list of email addresses using MailTester Ninja API, then generates and displays the results in an HTML table. You can integrate this code into your pngage or adapt it according to your needs.