Class: EmailControllerApi

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new EmailControllerApi(configuration?)

Parameters

NameType
configurationConfiguration

Inherited from

BaseAPI.constructor

Properties

configuration

Protected configuration: Configuration

Inherited from

BaseAPI.configuration

Methods

deleteAllEmails

deleteAllEmails(initOverrides?): Promise<void>

Deletes all emails in your account. Be careful as emails cannot be recovered Delete all emails in all inboxes.

Parameters

NameType
initOverrides?RequestInit

Returns

Promise<void>


deleteAllEmailsRaw

deleteAllEmailsRaw(initOverrides?): Promise<ApiResponse<void»

Deletes all emails in your account. Be careful as emails cannot be recovered Delete all emails in all inboxes.

Parameters

NameType
initOverrides?RequestInit

Returns

Promise<ApiResponse<void»


deleteEmail

deleteEmail(requestParameters, initOverrides?): Promise<void>

Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. Delete an email

Parameters

NameType
requestParametersDeleteEmailRequest
initOverrides?RequestInit

Returns

Promise<void>


deleteEmailRaw

deleteEmailRaw(requestParameters, initOverrides?): Promise<ApiResponse<void»

Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. Delete an email

Parameters

NameType
requestParametersDeleteEmailRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<void»


downloadAttachment

downloadAttachment(requestParameters, initOverrides?): Promise<string>

Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. Get email attachment bytes. Returned as octet-stream with content type header. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints and convert the base 64 encoded content to a file or string.

Parameters

NameType
requestParametersDownloadAttachmentRequest
initOverrides?RequestInit

Returns

Promise<string>


downloadAttachmentBase64

downloadAttachmentBase64(requestParameters, initOverrides?): Promise<DownloadAttachmentDto>

Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the downloadAttachment method but allows some clients to get around issues with binary responses. Get email attachment as base64 encoded string as an alternative to binary responses. Decode the base64FileContents as a utf-8 encoded string or array of bytes depending on the contentType.

Parameters

NameType
requestParametersDownloadAttachmentBase64Request
initOverrides?RequestInit

Returns

Promise<DownloadAttachmentDto>


downloadAttachmentBase64Raw

downloadAttachmentBase64Raw(requestParameters, initOverrides?): Promise<ApiResponse<DownloadAttachmentDto»

Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the downloadAttachment method but allows some clients to get around issues with binary responses. Get email attachment as base64 encoded string as an alternative to binary responses. Decode the base64FileContents as a utf-8 encoded string or array of bytes depending on the contentType.

Parameters

NameType
requestParametersDownloadAttachmentBase64Request
initOverrides?RequestInit

Returns

Promise<ApiResponse<DownloadAttachmentDto»


downloadAttachmentRaw

downloadAttachmentRaw(requestParameters, initOverrides?): Promise<ApiResponse<string»

Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. Get email attachment bytes. Returned as octet-stream with content type header. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints and convert the base 64 encoded content to a file or string.

Parameters

NameType
requestParametersDownloadAttachmentRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<string»


downloadBody

downloadBody(requestParameters, initOverrides?): Promise<string>

Returns the specified email body for a given email as a string Get email body as string. Returned as plain/text with content type header.

Parameters

NameType
requestParametersDownloadBodyRequest
initOverrides?RequestInit

Returns

Promise<string>


downloadBodyBytes

downloadBodyBytes(requestParameters, initOverrides?): Promise<string>

Returns the specified email body for a given email as a stream / array of bytes. Get email body in bytes. Returned as octet-stream with content type header.

Parameters

NameType
requestParametersDownloadBodyBytesRequest
initOverrides?RequestInit

Returns

Promise<string>


downloadBodyBytesRaw

downloadBodyBytesRaw(requestParameters, initOverrides?): Promise<ApiResponse<string»

Returns the specified email body for a given email as a stream / array of bytes. Get email body in bytes. Returned as octet-stream with content type header.

Parameters

NameType
requestParametersDownloadBodyBytesRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<string»


downloadBodyRaw

downloadBodyRaw(requestParameters, initOverrides?): Promise<ApiResponse<string»

Returns the specified email body for a given email as a string Get email body as string. Returned as plain/text with content type header.

Parameters

NameType
requestParametersDownloadBodyRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<string»


forwardEmail

forwardEmail(requestParameters, initOverrides?): Promise<SentEmailDto>

Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the from option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. Forward email to recipients

Parameters

NameType
requestParametersForwardEmailRequest
initOverrides?RequestInit

Returns

Promise<SentEmailDto>


forwardEmailRaw

forwardEmailRaw(requestParameters, initOverrides?): Promise<ApiResponse<SentEmailDto»

Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the from option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. Forward email to recipients

Parameters

NameType
requestParametersForwardEmailRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<SentEmailDto»


getAttachmentMetaData

getAttachmentMetaData(requestParameters, initOverrides?): Promise<AttachmentMetaData>

Returns the metadata such as name and content-type for a given attachment and email. Get email attachment metadata. This is the contentType and contentLength of an attachment. To get the individual attachments use the downloadAttachment methods.

Parameters

NameType
requestParametersGetAttachmentMetaDataRequest
initOverrides?RequestInit

Returns

Promise<AttachmentMetaData>


getAttachmentMetaDataRaw

getAttachmentMetaDataRaw(requestParameters, initOverrides?): Promise<ApiResponse<AttachmentMetaData»

Returns the metadata such as name and content-type for a given attachment and email. Get email attachment metadata. This is the contentType and contentLength of an attachment. To get the individual attachments use the downloadAttachment methods.

Parameters

NameType
requestParametersGetAttachmentMetaDataRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<AttachmentMetaData»


getAttachments1

getAttachments1(requestParameters, initOverrides?): Promise<AttachmentMetaData[]>

Returns an array of attachment metadata such as name and content-type for a given email if present. Get all email attachment metadata. Metadata includes name and size of attachments.

Parameters

NameType
requestParametersGetAttachments1Request
initOverrides?RequestInit

Returns

Promise<AttachmentMetaData[]>


getAttachments1Raw

getAttachments1Raw(requestParameters, initOverrides?): Promise<ApiResponse<AttachmentMetaData[]»

Returns an array of attachment metadata such as name and content-type for a given email if present. Get all email attachment metadata. Metadata includes name and size of attachments.

Parameters

NameType
requestParametersGetAttachments1Request
initOverrides?RequestInit

Returns

Promise<ApiResponse<AttachmentMetaData[]»


getEmail

getEmail(requestParameters, initOverrides?): Promise<Email>

Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.

Parameters

NameType
requestParametersGetEmailRequest
initOverrides?RequestInit

Returns

Promise<Email>


getEmailContentMatch

getEmailContentMatch(requestParameters, initOverrides?): Promise<EmailContentMatchResult>

Return the matches for a given Java style regex pattern. Do not include the typical / at start or end of regex in some languages. Given an example your code is: 12345 the pattern to extract match looks like code is: (d{6}). This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: ['code is: 123456', '123456'] See https://docs.oracle.com/javase/8/docs/api/java/util/regex/ for more information of available patterns. Get email content regex pattern match results. Runs regex against email body and returns match groups.

Parameters

NameType
requestParametersGetEmailContentMatchRequest
initOverrides?RequestInit

Returns

Promise<EmailContentMatchResult>


getEmailContentMatchRaw

getEmailContentMatchRaw(requestParameters, initOverrides?): Promise<ApiResponse<EmailContentMatchResult»

Return the matches for a given Java style regex pattern. Do not include the typical / at start or end of regex in some languages. Given an example your code is: 12345 the pattern to extract match looks like code is: (d{6}). This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: ['code is: 123456', '123456'] See https://docs.oracle.com/javase/8/docs/api/java/util/regex/ for more information of available patterns. Get email content regex pattern match results. Runs regex against email body and returns match groups.

Parameters

NameType
requestParametersGetEmailContentMatchRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<EmailContentMatchResult»


getEmailHTML

getEmailHTML(requestParameters, initOverrides?): Promise<string>

Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: ?apiKey=xxx Get email content as HTML. For displaying emails in browser context.

Parameters

NameType
requestParametersGetEmailHTMLRequest
initOverrides?RequestInit

Returns

Promise<string>


getEmailHTMLQuery

getEmailHTMLQuery(requestParameters, initOverrides?): Promise<EmailTextLinesResult>

Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors Parse and return text from an email, stripping HTML and decoding encoded characters

Parameters

NameType
requestParametersGetEmailHTMLQueryRequest
initOverrides?RequestInit

Returns

Promise<EmailTextLinesResult>


getEmailHTMLQueryRaw

getEmailHTMLQueryRaw(requestParameters, initOverrides?): Promise<ApiResponse<EmailTextLinesResult»

Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors Parse and return text from an email, stripping HTML and decoding encoded characters

Parameters

NameType
requestParametersGetEmailHTMLQueryRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<EmailTextLinesResult»


getEmailHTMLRaw

getEmailHTMLRaw(requestParameters, initOverrides?): Promise<ApiResponse<string»

Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: ?apiKey=xxx Get email content as HTML. For displaying emails in browser context.

Parameters

NameType
requestParametersGetEmailHTMLRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<string»


getEmailLinks(requestParameters, initOverrides?): Promise<EmailLinksResult>

HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes Parse and return list of links found in an email (only works for HTML content)

Parameters

NameType
requestParametersGetEmailLinksRequest
initOverrides?RequestInit

Returns

Promise<EmailLinksResult>


getEmailLinksRaw

getEmailLinksRaw(requestParameters, initOverrides?): Promise<ApiResponse<EmailLinksResult»

HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes Parse and return list of links found in an email (only works for HTML content)

Parameters

NameType
requestParametersGetEmailLinksRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<EmailLinksResult»


getEmailRaw

getEmailRaw(requestParameters, initOverrides?): Promise<ApiResponse<Email»

Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.

Parameters

NameType
requestParametersGetEmailRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<Email»


getEmailTextLines

getEmailTextLines(requestParameters, initOverrides?): Promise<EmailTextLinesResult>

Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. Parse and return text from an email, stripping HTML and decoding encoded characters

Parameters

NameType
requestParametersGetEmailTextLinesRequest
initOverrides?RequestInit

Returns

Promise<EmailTextLinesResult>


getEmailTextLinesRaw

getEmailTextLinesRaw(requestParameters, initOverrides?): Promise<ApiResponse<EmailTextLinesResult»

Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. Parse and return text from an email, stripping HTML and decoding encoded characters

Parameters

NameType
requestParametersGetEmailTextLinesRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<EmailTextLinesResult»


getEmailsPaginated

getEmailsPaginated(requestParameters, initOverrides?): Promise<PageEmailProjection>

By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages Get all emails in all inboxes in paginated form. Email API list all.

Parameters

NameType
requestParametersGetEmailsPaginatedRequest
initOverrides?RequestInit

Returns

Promise<PageEmailProjection>


getEmailsPaginatedRaw

getEmailsPaginatedRaw(requestParameters, initOverrides?): Promise<ApiResponse<PageEmailProjection»

By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages Get all emails in all inboxes in paginated form. Email API list all.

Parameters

NameType
requestParametersGetEmailsPaginatedRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<PageEmailProjection»


getGravatarUrlForEmailAddress

getGravatarUrlForEmailAddress(requestParameters, initOverrides?): Promise<GravatarUrl>

Get gravatar url for email address

Parameters

NameType
requestParametersGetGravatarUrlForEmailAddressRequest
initOverrides?RequestInit

Returns

Promise<GravatarUrl>


getGravatarUrlForEmailAddressRaw

getGravatarUrlForEmailAddressRaw(requestParameters, initOverrides?): Promise<ApiResponse<GravatarUrl»

Get gravatar url for email address

Parameters

NameType
requestParametersGetGravatarUrlForEmailAddressRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<GravatarUrl»


getLatestEmail

getLatestEmail(requestParameters, initOverrides?): Promise<Email>

Get the newest email in all inboxes or in a passed set of inbox IDs Get latest email in all inboxes. Most recently received.

Parameters

NameType
requestParametersGetLatestEmailRequest
initOverrides?RequestInit

Returns

Promise<Email>


getLatestEmailInInbox

getLatestEmailInInbox(requestParameters, initOverrides?): Promise<Email>

Get the newest email in all inboxes or in a passed set of inbox IDs Get latest email in an inbox. Use WaitForController to get emails that may not have arrived yet.

Parameters

NameType
requestParametersGetLatestEmailInInboxRequest
initOverrides?RequestInit

Returns

Promise<Email>


getLatestEmailInInboxRaw

getLatestEmailInInboxRaw(requestParameters, initOverrides?): Promise<ApiResponse<Email»

Get the newest email in all inboxes or in a passed set of inbox IDs Get latest email in an inbox. Use WaitForController to get emails that may not have arrived yet.

Parameters

NameType
requestParametersGetLatestEmailInInboxRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<Email»


getLatestEmailRaw

getLatestEmailRaw(requestParameters, initOverrides?): Promise<ApiResponse<Email»

Get the newest email in all inboxes or in a passed set of inbox IDs Get latest email in all inboxes. Most recently received.

Parameters

NameType
requestParametersGetLatestEmailRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<Email»


getOrganizationEmailsPaginated

getOrganizationEmailsPaginated(requestParameters, initOverrides?): Promise<PageEmailProjection>

By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages Get all organization emails. List team or shared test email accounts

Parameters

NameType
requestParametersGetOrganizationEmailsPaginatedRequest
initOverrides?RequestInit

Returns

Promise<PageEmailProjection>


getOrganizationEmailsPaginatedRaw

getOrganizationEmailsPaginatedRaw(requestParameters, initOverrides?): Promise<ApiResponse<PageEmailProjection»

By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages Get all organization emails. List team or shared test email accounts

Parameters

NameType
requestParametersGetOrganizationEmailsPaginatedRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<PageEmailProjection»


getRawEmailContents

getRawEmailContents(requestParameters, initOverrides?): Promise<string>

Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint Get raw email string. Returns unparsed raw SMTP message with headers and body.

Parameters

NameType
requestParametersGetRawEmailContentsRequest
initOverrides?RequestInit

Returns

Promise<string>


getRawEmailContentsRaw

getRawEmailContentsRaw(requestParameters, initOverrides?): Promise<ApiResponse<string»

Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint Get raw email string. Returns unparsed raw SMTP message with headers and body.

Parameters

NameType
requestParametersGetRawEmailContentsRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<string»


getRawEmailJson

getRawEmailJson(requestParameters, initOverrides?): Promise<RawEmailJson>

Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.

Parameters

NameType
requestParametersGetRawEmailJsonRequest
initOverrides?RequestInit

Returns

Promise<RawEmailJson>


getRawEmailJsonRaw

getRawEmailJsonRaw(requestParameters, initOverrides?): Promise<ApiResponse<RawEmailJson»

Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.

Parameters

NameType
requestParametersGetRawEmailJsonRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<RawEmailJson»


getUnreadEmailCount

getUnreadEmailCount(initOverrides?): Promise<UnreadCount>

Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response Get unread email count

Parameters

NameType
initOverrides?RequestInit

Returns

Promise<UnreadCount>


getUnreadEmailCountRaw

getUnreadEmailCountRaw(initOverrides?): Promise<ApiResponse<UnreadCount»

Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response Get unread email count

Parameters

NameType
initOverrides?RequestInit

Returns

Promise<ApiResponse<UnreadCount»


markAsRead

markAsRead(requestParameters, initOverrides?): Promise<EmailPreview>

Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread Mark an email as read on unread

Parameters

NameType
requestParametersMarkAsReadRequest
initOverrides?RequestInit

Returns

Promise<EmailPreview>


markAsReadRaw

markAsReadRaw(requestParameters, initOverrides?): Promise<ApiResponse<EmailPreview»

Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread Mark an email as read on unread

Parameters

NameType
requestParametersMarkAsReadRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<EmailPreview»


replyToEmail

replyToEmail(requestParameters, initOverrides?): Promise<SentEmailDto>

Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails to, cc, and bcc. Reply to an email

Parameters

NameType
requestParametersReplyToEmailRequest
initOverrides?RequestInit

Returns

Promise<SentEmailDto>


replyToEmailRaw

replyToEmailRaw(requestParameters, initOverrides?): Promise<ApiResponse<SentEmailDto»

Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails to, cc, and bcc. Reply to an email

Parameters

NameType
requestParametersReplyToEmailRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<SentEmailDto»


request

Protected request(context, initOverrides?): Promise<Response>

Parameters

NameType
contextRequestOpts
initOverrides?RequestInit

Returns

Promise<Response>

Inherited from

BaseAPI.request


sendEmailSourceOptional

sendEmailSourceOptional(requestParameters, initOverrides?): Promise<void>

Alias for InboxController.sendEmail method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. Send email

Parameters

NameType
requestParametersSendEmailSourceOptionalRequest
initOverrides?RequestInit

Returns

Promise<void>


sendEmailSourceOptionalRaw

sendEmailSourceOptionalRaw(requestParameters, initOverrides?): Promise<ApiResponse<void»

Alias for InboxController.sendEmail method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. Send email

Parameters

NameType
requestParametersSendEmailSourceOptionalRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<void»


validateEmail

validateEmail(requestParameters, initOverrides?): Promise<ValidationDto>

Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. Validate email HTML contents

Parameters

NameType
requestParametersValidateEmailRequest
initOverrides?RequestInit

Returns

Promise<ValidationDto>


validateEmailRaw

validateEmailRaw(requestParameters, initOverrides?): Promise<ApiResponse<ValidationDto»

Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. Validate email HTML contents

Parameters

NameType
requestParametersValidateEmailRequest
initOverrides?RequestInit

Returns

Promise<ApiResponse<ValidationDto»


withMiddleware

withMiddleware<T>(…middlewares): T

Type parameters

NameType
Textends BaseAPI<T>

Parameters

NameType
...middlewaresMiddleware[]

Returns

T

Inherited from

BaseAPI.withMiddleware


withPostMiddleware

withPostMiddleware<T>(…postMiddlewares): T

Type parameters

NameType
Textends BaseAPI<T>

Parameters

NameType
...postMiddlewares(context: ResponseContext) => Promise<void

Returns

T

Inherited from

BaseAPI.withPostMiddleware


withPreMiddleware

withPreMiddleware<T>(…preMiddlewares): T

Type parameters

NameType
Textends BaseAPI<T>

Parameters

NameType
...preMiddlewares(context: RequestContext) => Promise<void

Returns

T

Inherited from

BaseAPI.withPreMiddleware