How to send emails using queue backed architecture

Ensure email delivery using MailSlurp scalable message queues

MailSlurp supports sending emails in a reliable and scalable way using SQS-backed message queues.

What is a queue?

Message queues are a first in first out pub/sub system that allow software systems to recover from failures by placing failed actions into a deadletter queue that can be redriven. MailSlurp uses queues internally to recover inbound and outbound emails when the server is down for maintenance or because of errors. This means MailSlurp can ensure delivery and acceptance of emails at all times. You can also use these queues to make your transactional email delivery more reliable.

Example usage

Send with queue methods are available in all SDK libraries and the REST API. Here is an example using the MailSlurp Javascript client:

await mailslurp.inboxController.sendEmailWithQueue({
  inboxId: inboxId,
  sendEmailOptions: {
    to: [recipient],
    subject: 'Sent with a queue',
      'Use queues to allow recovery of failed email ' +
      'sending when account reaches limits or has payment issues',
  // validate before adding to queue to fail early
  validateBeforeEnqueue: false,

Failure and recovery

There are several ways in which standard email delivery might fail:

  • Recipient mail account rejects message
  • Your account has a payment issue and is blocking sending
  • An outage on MailSlurp

Use queues to prevent email delivery failures in all of these cases. If delivery is disrupted MailSlurp will reject the queue message and will place it back on the queue and retry indefinitely until it succeeds.

Ready to dive in?Start building email applications today.