Skip to main content

Emails

MailSlurp can send and receive emails and attachments. Let us cover some common functions.

Sending emails

send email

To send emails first create an inbox. Then use the dashboard compose page or the sendEmail methods on the inbox controller.

Loading...

Sending attachments

To send attachments first upload the attachment using the attachment controller:

Loading...

Then send an email using the attachment ID.

Loading...

Validating email recipients

You can verify recipients when sending emails:

Loading...

See the verification guide for more options.

Use content templates

You can create email templates that support moustache style variables.

Loading...

Then send email using the template and pass variables for replacement.

Loading...

Sending with schedule

You can send email with a delay or scheduled delivery time like so:

Loading...

Sending with queues

Use the sending queue to ensure emails are retried if they fail or your account experiences temporary limits.

Loading...

Sending with SMTP/IMAP

Create an SMTP type inbox. Then use the IMAP or SMTP access details to access the inbox in code or from a mail client.

Loading...

See the IMAP SMTP guide for more information.

Sent emails

Each sent email can be accessed with the SentEmail controller:

Loading...

Delivery status

When emails are delivered an event is created. You can subscribe to delivery events using webhooks or view them in the dashboard.

Receiving emails

Inboxes receive emails. You can use the InboxController and EmailController to read email or use webhooks to have emails sent to your server directly.

Read emails in dashboard

The dashboard provides HTML previews for received emails:

Fetch emails in code

Emails are stored in the inbox that receives them. You can fetch emails directly using the inbox controller.

Loading...

Download attachments

You can download attachments by using the attachment ID.

Loading...

See the attachments page for more information.

Spam review

Every email is automatically scanned for viruses and spam ratings. You can access these on the email object.

Loading...

Wait for emails

The email wait for methods allow you to hold a request open until matching emails are found. This is very useful for receiving emails in tests when after you have performed an action.

Loading...

You can create complex search terms to match for email contents:

Loading...

Receive email with webhooks

The best way to receive emails at scale is by using webhooks.

Loading...

Receive emails from connectors

If you have connected a 3rd party email account with MailSlurp inbox connectors you can synchronize emails between them using the connector controller. Emails are also synchronized during wait for methods and if you pass a syncConnectors argument to fetch email commands. This means MailSlurp will pull new emails from your external mailbox before returning results.

Test email content

MailSlurp provides many features for testing the rendering, validity, and client-support of email content. You can use MailSlurp to check spam ratings, DKIM/DMARC/SPF records, CSS/HTML feature support, cross-device rendering, broken links and more.