Skip to content
No description, website, or topics provided.
Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

MailSlurp API Bash client


This is a Bash client script for accessing MailSlurp API service.

The script uses cURL underneath for making all REST calls.


# Make sure the script has executable rights
$ chmod u+x mailslurp

# Print the list of operations available on the service
$ ./mailslurp -h

# Print the service description
$ ./mailslurp --about

# Print detailed information about specific operation
$ ./mailslurp <operationId> -h

# Make GET request
./mailslurp --host http://<hostname>:<port> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>

# Make GET request using arbitrary curl options (must be passed before <operationId>) to an SSL service using username:password
mailslurp -k -sS --tlsv1.2 --host https://<hostname> -u <user>:<password> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>

# Make POST request
$ echo '<body_content>' | mailslurp --host <hostname> --content-type json <operationId> -

# Make POST request with simple JSON content, e.g.:
# {
#   "key1": "value1",
#   "key2": "value2",
#   "key3": 23
# }
$ echo '<body_content>' | mailslurp --host <hostname> --content-type json <operationId> key1==value1 key2=value2 key3:=23 -

# Preview the cURL command without actually executing it
$ mailslurp --host http://<hostname>:<port> --dry-run <operationid>

Docker image

You can easily create a Docker image containing a preconfigured environment for using the REST Bash client including working autocompletion and short welcome message with basic instructions, using the generated Dockerfile:

docker build -t my-rest-client .
docker run -it my-rest-client

By default you will be logged into a Zsh environment which has much more advanced auto completion, but you can switch to Bash, where basic autocompletion is also available.

Shell completion


The generated bash-completion script can be either directly loaded to the current Bash session using:

source mailslurp.bash-completion

Alternatively, the script can be copied to the /etc/bash-completion.d (or on OSX with Homebrew to /usr/local/etc/bash-completion.d):

sudo cp mailslurp.bash-completion /etc/bash-completion.d/mailslurp


On OSX you might need to install bash-completion using Homebrew:

brew install bash-completion

and add the following to the ~/.bashrc:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion


In Zsh, the generated _mailslurp Zsh completion file must be copied to one of the folders under $FPATH variable.

Documentation for API Endpoints

All URIs are relative to **

Class Method HTTP request Description
CommonOperationsApi createNewEmailAddress POST /newEmailAddress Create new email address
CommonOperationsApi deleteEmail DELETE /deleteEmail Delete an email
CommonOperationsApi deleteEmailAddress DELETE /deleteEmailAddress Delete email address and its emails
CommonOperationsApi emptyInbox DELETE /emptyInbox Delete all emails in an inbox
CommonOperationsApi sendEmailSimple POST /sendEmail Send an email from a random email address
CommonOperationsApi waitForEmailCount GET /waitForEmailCount Wait for and return count number of emails
CommonOperationsApi waitForLatestEmail GET /waitForLatestEmail Fetch inbox's latest email or if empty wait for email to arrive
CommonOperationsApi waitForMatchingEmail POST /waitForMatchingEmails Wait or return list of emails that match simple matching patterns
CommonOperationsApi waitForNthEmail GET /waitForNthEmail Wait for or fetch the email with a given index in the inbox specified
ExtraOperationsApi bulkCreateInboxes POST /bulk/inboxes Bulk create Inboxes (email addresses)
ExtraOperationsApi bulkDeleteInboxes DELETE /bulk/inboxes Bulk Delete Inboxes
ExtraOperationsApi bulkSendEmails POST /bulk/send Bulk Send Emails
ExtraOperationsApi createInbox POST /inboxes Create an Inbox (email address)
ExtraOperationsApi createWebhook POST /inboxes/{inboxId}/webhooks Attach a WebHook URL to an inbox
ExtraOperationsApi deleteEmail1 DELETE /emails/{emailId} Delete Email
ExtraOperationsApi deleteInbox DELETE /inboxes/{inboxId} Delete Inbox / Email Address
ExtraOperationsApi deleteWebhook DELETE /inboxes/{inboxId}/webhooks/{webhookId} Delete and disable a WebHook for an Inbox
ExtraOperationsApi downloadAttachment GET /emails/{emailId}/attachments/{attachmentId} Get email attachment
ExtraOperationsApi forwardEmail POST /emails/{emailId}/forward Forward Email
ExtraOperationsApi getEmail GET /emails/{emailId} Get Email Content
ExtraOperationsApi getEmails GET /inboxes/{inboxId}/emails List Emails in an Inbox / EmailAddress
ExtraOperationsApi getInbox GET /inboxes/{inboxId} Get Inbox / EmailAddress
ExtraOperationsApi getInboxes GET /inboxes List Inboxes / Email Addresses
ExtraOperationsApi getRawEmailContents GET /emails/{emailId}/raw Get Raw Email Content
ExtraOperationsApi getWebhooks GET /inboxes/{inboxId}/webhooks Get all WebHooks for an Inbox
ExtraOperationsApi sendEmail POST /inboxes/{inboxId} Send Email
ExtraOperationsApi uploadAttachment POST /attachments Upload an attachment for sending
ExtraOperationsApi uploadMultipartForm 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
You can’t perform that action at this time.