Virtual inboxes
Use mail traps to prevent email sending in production
MailSlurp inboxes can be used to trap outbound emails so that no emails are ever sent to real recipients. Catching mail requires the creation of 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 capture outbound emails and prevent the sending to real customers. You can verify sent email 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