Email API custom domain

Hosted email domains for custom mail servers

email custom domain hosted

If you have a custom email address that matches your companies domain you may wish to use it programmatically in code or tests. With MailSlurp you can keep access to your custom email address and also access it in scripts and code.

Custom domain setup

First register a free account with MailSlurp. Add your domain and follow the steps to verify your domain.

create domain

Setup API access

You can call the MailSlurp email API using the REST API or one of the many official SDK libraries.

api key

Configure your client with the API Key or set the REST header x-api-key to your value.

Example code

MailSlurp supports many languages and also has a web app you can use instead:

email apis

Here is a Javascript example using Cypress JS to receive emails.

it("03 - can receive confirmation code by email", function () {
    // app will send user an email containing a code, use mailslurp to wait for the latest email
    cy.mailslurp()
        // use inbox id and a timeout of 30 seconds
        .then(mailslurp => mailslurp.waitForLatestEmail(this.inboxId, 30000, true))
        // extract the confirmation code from the email body
        .then(email => /.*verification code is (\d{6}).*/.exec(email.body!!)!![1])
        // fill out the confirmation form and submit
        .then(code => {
            cy.get("[name=code]").type(code).trigger('change');
            cy.get("[data-test=confirm-sign-up-confirm-button]").click();
        })
});

Related content

Fake email generator tutorial

Fake email accounts for QA testers and developers

Temporary email accounts

Free email account generator and API. Create unlimited test email accounts. Add custom domain support with a plan.

Email API custom domain

Hosted email domains for custom mail servers

Email Generator

Fake email account generator for testing and development. Create real email accounts.

Using fake email generators

Create fake email accounts with MailSlurp. Fake email generator for testing and social.

Ready to dive in?Start building email applications today.