Auto forwarding

MailSlurp inboxes support email auto-forwarding using inbox forwarders.

Code example

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

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

test('inbox forwarding', async () => {
    // create two inboxes for testing
    const inbox1 = await mailslurp.inboxController.createInboxWithDefaults()
    const inbox2 = await mailslurp.inboxController.createInboxWithDefaults()
    const inbox3 = await mailslurp.inboxController.createInboxWithDefaults()

    // add auto forwarding rule to inbox 2
    await mailslurp.inboxForwarderController.createNewInboxForwarder({
        field: CreateInboxForwarderOptions.FieldEnum.SENDER,
        match: inbox1.emailAddress,
        forwardToRecipients: [inbox3.emailAddress]

    // send email from inbox1 to inbox2
    await mailslurp.sendEmail(!!, { to: [inbox2.emailAddress!!], subject:"Hello" })

    // see that inbox2 gets the original email
    const receivedEmail = await mailslurp.waitForLatestEmail(, 60000, true)

    // see that inbox3 gets a forwarded email
    const forwardedEmail = await mailslurp.waitForLatestEmail(, 60000, true)