Virtual inboxes
Documentation navigation
Capture outbound email in a MailSlurp virtual inbox so test and staging messages can be inspected without reaching real recipients.
MailSlurp virtual inboxes capture outbound email before it reaches a real recipient. This gives tests and staging workflows a safe place to inspect each message. Start by creating a virtual inbox.
Creating mail catchers
Javascript
const mailTrap = await mailslurp.inboxController.createInboxWithOptions({
createInboxDto: {
virtualInbox: true,
},
});
C#
Go
Java
PHP
Python
Ruby
More
Trapping outbound sent emails
Virtual inboxes keep outbound messages inside MailSlurp instead of sending them to real customers. You can verify a captured message using the virtualSend property.
Javascript
const sent = await mailslurp.inboxController.sendEmailAndConfirm({
inboxId: mailTrap.id,
sendEmailOptions: {
to: [customer.emailAddress],
subject: 'Test email',
body: 'This is using a virtual inbox and will not be sent to real customers',
},
});
expect(sent.to).toContain(customer.emailAddress);
expect(sent.virtualSend).toBeTruthy();
C#
Go
Java
PHP
Python
Ruby
More