GoLang Documentation

How to send and receive emails in Golang. Generate email addresses on demand.

Go API client for mailslurp

Requires Go 1.7+. go get mailslurp/mailslurp-client-go

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 API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 0.0.1-alpha
  • Package version: 5.2.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.mailslurp.com


Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./mailslurp"

Documentation for API Endpoints

All URIs are relative to https://api.mailslurp.com

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 CreateDomain Post /domains Create Domain
ExtraOperationsApi CreateInbox Post /inboxes Create an Inbox (email address)
ExtraOperationsApi CreateWebhook Post /inboxes/{inboxId}/webhooks Attach a WebHook URL to an inbox
ExtraOperationsApi DeleteDomain Delete /domains/{id} Delete a domain
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 GetDomain Get /domains/{id} Get a domain
ExtraOperationsApi GetDomains Get /domains Get domains
ExtraOperationsApi GetEmail Get /emails/{emailId} Get Email Content
ExtraOperationsApi GetEmails Get /inboxes/{inboxId}/emails List Emails in an Inbox / EmailAddress
ExtraOperationsApi GetEmailsPaginated Get /emails Get all emails
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


auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
	Key: "APIKEY",
	Prefix: "Bearer", // Omit if not necessary.
r, err := client.Service.Operation(auth, args)