Email address verification

The process of checking email addresses to ensure they are real and can receive emails is important for many applications. MailSlurp provides a free email address verification and checking function that calls mail servers to ask if given email addresses exist. You can verify email addresses online using the MailSlurp dashboard or in code and tests using the MailSlurp developer SDK.

Verify email addresses online for free

You can use the MailSlurp dashboard to verify email addresses for free.

validate email address

Simply sign-up or login to MailSlurp using the online email dashboard and navigate to the MailServer section in the sidebar. Enter an email address and click submit to validate the email.

Email API usage - verify email addresses in code

Use the MailSlurp email API to test email accounts are valid. Here is an example in Javascript:

npm install mailslurp-client jest

Create an instance of the MailSlurp client and use the MailServerController verifyEmailAddress function to verify and email account.

import {CreateInboxDto, MailSlurp} from 'mailslurp-client';

const mailslurp = new MailSlurp({ apiKey: process.env.apiKey });
jest.setTimeout(120000);

describe('can manage smtp inboxes', () => {
    it('can verify an external email address with a provider like gmail', async () => {
        const result = await mailslurp.mailServerController.verifyEmailAddress({
            emailAddress: "contact@mailslurp.dev"
        })
        expect(result.isValid).toEqual(true)
    });
});

How does it work?

MailSlurp derives a mailserver for an email address by digging the MX records for the domain. It then connects via telnet to the server and sends the rcpt to:<emailaddress> command to check that the email exists on the server. This is the most reliable way to ensure that an email address really exists.