MailSlurpClient - the Ruby gem for the MailSlurp API

For documentation see developer guide. Create an account in the MailSlurp Dashboard to view your API Key. For all bugs, feature requests, or help please see support.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 0.0.1-alpha
  • Package version: 5.0.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit


Build a gem

To build the Ruby code into a gem:

gem build mailslurp_client.gemspec

Then either install the gem locally:

gem install ./mailslurp_client-5.0.0.gem

(for development, run gem install --dev ./mailslurp_client-5.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'mailslurp_client', '~> 5.0.0'

Install from Git

If the Ruby gem is hosted at a git repository:, then add the following in the Gemfile:

gem 'mailslurp_client', :git => ''

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'mailslurp_client'

# Setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'


api_instance =

  #Create new email address
  result = api_instance.create_new_email_address
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling CommonOperationsApi->create_new_email_address: #{e}"

Documentation for API Endpoints

All URIs are relative to

Class Method HTTP request Description
MailSlurpClient::CommonOperationsApi create_new_email_address POST /newEmailAddress Create new email address
MailSlurpClient::CommonOperationsApi delete_email DELETE /deleteEmail Delete an email
MailSlurpClient::CommonOperationsApi delete_email_address DELETE /deleteEmailAddress Delete email address and its emails
MailSlurpClient::CommonOperationsApi empty_inbox DELETE /emptyInbox Delete all emails in an inbox
MailSlurpClient::CommonOperationsApi send_email_simple POST /sendEmail Send an email from a random email address
MailSlurpClient::CommonOperationsApi wait_for_email_count GET /waitForEmailCount Wait for and return count number of emails
MailSlurpClient::CommonOperationsApi wait_for_latest_email GET /waitForLatestEmail Fetch inbox's latest email or if empty wait for email to arrive
MailSlurpClient::CommonOperationsApi wait_for_matching_email POST /waitForMatchingEmails Wait or return list of emails that match simple matching patterns
MailSlurpClient::CommonOperationsApi wait_for_nth_email GET /waitForNthEmail Wait for or fetch the email with a given index in the inbox specified
MailSlurpClient::ExtraOperationsApi bulk_create_inboxes POST /bulk/inboxes Bulk create Inboxes (email addresses)
MailSlurpClient::ExtraOperationsApi bulk_delete_inboxes DELETE /bulk/inboxes Bulk Delete Inboxes
MailSlurpClient::ExtraOperationsApi bulk_send_emails POST /bulk/send Bulk Send Emails
MailSlurpClient::ExtraOperationsApi create_inbox POST /inboxes Create an Inbox (email address)
MailSlurpClient::ExtraOperationsApi create_webhook POST /inboxes/inboxId/webhooks Attach a WebHook URL to an inbox
MailSlurpClient::ExtraOperationsApi delete_email1 DELETE /emails/emailId Delete Email
MailSlurpClient::ExtraOperationsApi delete_inbox DELETE /inboxes/inboxId Delete Inbox / Email Address
MailSlurpClient::ExtraOperationsApi delete_webhook DELETE /inboxes/inboxId/webhooks/webhookId Delete and disable a WebHook for an Inbox
MailSlurpClient::ExtraOperationsApi download_attachment GET /emails/emailId/attachments/attachmentId Get email attachment
MailSlurpClient::ExtraOperationsApi forward_email POST /emails/emailId/forward Forward Email
MailSlurpClient::ExtraOperationsApi get_email GET /emails/emailId Get Email Content
MailSlurpClient::ExtraOperationsApi get_emails GET /inboxes/inboxId/emails List Emails in an Inbox / EmailAddress
MailSlurpClient::ExtraOperationsApi get_inbox GET /inboxes/inboxId Get Inbox / EmailAddress
MailSlurpClient::ExtraOperationsApi get_inboxes GET /inboxes List Inboxes / Email Addresses
MailSlurpClient::ExtraOperationsApi get_raw_email_contents GET /emails/emailId/raw Get Raw Email Content
MailSlurpClient::ExtraOperationsApi get_webhooks GET /inboxes/inboxId/webhooks Get all WebHooks for an Inbox
MailSlurpClient::ExtraOperationsApi send_email POST /inboxes/inboxId Send Email
MailSlurpClient::ExtraOperationsApi upload_attachment POST /attachments Upload an attachment for sending
MailSlurpClient::ExtraOperationsApi upload_multipart_form POST /attachments/multipart Upload an attachment for sending using Multipart Form

Documentation for Models

Documentation for Authorization


  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header