Once you have created an inbox any emails sent to its email address received and saved under the inboxes ID. MailSlurp allows you to fetch and receive emails send to an inbox's email address in several ways:

Options

Visual dashboard

The simplest way to receive emails is to create an inbox and send it an email using your email provider. You can then view the emails in your dashboard.

Individual emails

If you know that an email exists and you have its simply call a method to get a full email object that includes the body.

WaitFor methods

For programmatic use-cases the MailSlurp API and SDKs provide WaitFor methods. This is the recommended way to receive emails.

WaitFor methods hold a connection until a condition is met. If the condition is met a list of matching entities is returned. These contain email values that can be used to fetch individual emails.

There are several variations:

Wait For Latest

Wait For Email Count

Wait For Matching Emails

Wait For Nth Email

All Emails

You can fetch all existing emails from an inbox with the methods. These methods return a collection of .

To get the body or attachments for an email you must call or methods individually.

Webhooks

WebHooks are a way to be notified via HTTP POST when a message is received. If you attach a WebHook to an inbox the WebHook URL will be notified when a new email is received. WebHooks are useful for high throughput applications or for environments where WaitFor methods are not appropriate.

Receiving attachments

Whenever MailSlurp receives email it extras attachments and stores them securely to disk. Attachments are not returned directly when emails are fetched. Instead you must obtain the attachment IDs from an email and then call attachment methods to receive attachment metadata and binary content.


Next →