MailSlurpClient - the Ruby gem for the MailSlurp API

For extensive guides and examples see full documentation. 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 Swagger Codegen project:

  • API version: 0.0.1-alpha
  • Package version: 1.0.1
  • Build package: io.swagger.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-1.0.1.gem

(for development, run gem install --dev ./mailslurp-client-1.0.1.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', '~> 1.0.1'

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_using_post
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling CommonOperationsApi->create_new_email_address_using_post: #{e}"

Documentation for API Endpoints

All URIs are relative to

Class Method HTTP request Description
MailSlurpClient::CommonOperationsApi create_new_email_address_using_post POST /newEmailAddress Create new email address
MailSlurpClient::CommonOperationsApi fetch_latest_email_using_get GET /fetchLatestEmail Fetch inbox's latest email or if empty wait for email to arrive
MailSlurpClient::CommonOperationsApi send_email_simple_using_post POST /sendEmail Send an email from a random email address
MailSlurpClient::ExtraOperationsApi bulk_create_inboxes_using_post POST /bulk/inboxes Bulk create Inboxes (email addresses)
MailSlurpClient::ExtraOperationsApi bulk_delete_inboxes_using_delete DELETE /bulk/inboxes Bulk Delete Inboxes
MailSlurpClient::ExtraOperationsApi bulk_send_emails_using_post POST /bulk/send Bulk Send Emails
MailSlurpClient::ExtraOperationsApi create_inbox_using_post POST /inboxes Create an Inbox (email address)
MailSlurpClient::ExtraOperationsApi delete_email_using_delete DELETE /emails/emailId Delete Email
MailSlurpClient::ExtraOperationsApi delete_inbox_using_delete DELETE /inboxes/inboxId Delete Inbox
MailSlurpClient::ExtraOperationsApi get_email_using_get GET /emails/emailId Get Email Content
MailSlurpClient::ExtraOperationsApi get_emails_using_get GET /inboxes/inboxId/emails List an Inbox's Emails
MailSlurpClient::ExtraOperationsApi get_inbox_using_get GET /inboxes/inboxId Get Inbox
MailSlurpClient::ExtraOperationsApi get_inboxes_using_get GET /inboxes List Inboxes
MailSlurpClient::ExtraOperationsApi get_raw_email_using_get GET /emails/emailId/raw Get Raw Email Content
MailSlurpClient::ExtraOperationsApi send_email_using_post POST /inboxes/inboxId Send Email

Documentation for Models

Documentation for Authorization


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