MailSlurp JS

Globals / EmailControllerApi

Class: EmailControllerApi

EmailControllerApi - object-oriented interface

export

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Inherited from BaseAPI.constructor

Defined in src/generated/api.ts:57

Parameters:

NameTypeDefault value
configuration?Configuration-
basePathstringBASE_PATH
fetchFetchAPIportableFetch

Returns: EmailControllerApi

Properties

basePath

Protected basePath: string

Inherited from BaseAPI.basePath

Defined in src/generated/api.ts:61


configuration

Protected configuration: Configuration

Inherited from BaseAPI.configuration

Defined in src/generated/api.ts:57


fetch

Protected fetch: FetchAPI

Inherited from BaseAPI.fetch

Defined in src/generated/api.ts:62

Methods

deleteAllEmails

deleteAllEmails(options?: any): Promise

Defined in src/generated/api.ts:13182

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

summary Delete all emails in all inboxes.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameType
options?any

Returns: Promise


deleteEmail

deleteEmail(emailId: string, options?: any): Promise

Defined in src/generated/api.ts:13196

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

summary Delete an email

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email to delete
options?any-

Returns: Promise


downloadAttachment

downloadAttachment(attachmentId: string, emailId: string, apiKey?: string, options?: any): Promise

Defined in src/generated/api.ts:13213

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.

summary 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.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
attachmentIdstringID of attachment
emailIdstringID of email
apiKey?string-
options?any-

Returns: Promise


downloadAttachmentBase64

downloadAttachmentBase64(attachmentId: string, emailId: string, options?: any): Promise<DownloadAttachmentDto>

Defined in src/generated/api.ts:13236

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.

summary 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.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
attachmentIdstringID of attachment
emailIdstringID of email
options?any-

Returns: Promise<DownloadAttachmentDto>


downloadBody

downloadBody(emailId: string, options?: any): Promise

Defined in src/generated/api.ts:13257

Returns the specified email body for a given email as a string

summary Get email body as string. Returned as plain/text with content type header.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email
options?any-

Returns: Promise


downloadBodyBytes

downloadBodyBytes(emailId: string, options?: any): Promise

Defined in src/generated/api.ts:13272

Returns the specified email body for a given email as a stream / array of bytes.

summary Get email body in bytes. Returned as octet-stream with content type header.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email
options?any-

Returns: Promise


forwardEmail

forwardEmail(emailId: string, forwardEmailOptions: ForwardEmailOptions, options?: any): Promise

Defined in src/generated/api.ts:13288

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.

summary Forward email to recipients

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email
forwardEmailOptionsForwardEmailOptionsforwardEmailOptions
options?any-

Returns: Promise


getAttachmentMetaData

getAttachmentMetaData(attachmentId: string, emailId: string, options?: any): Promise<AttachmentMetaData>

Defined in src/generated/api.ts:13309

Returns the metadata such as name and content-type for a given attachment and email.

summary Get email attachment metadata. This is the contentType and contentLength of an attachment. To get the individual attachments use the downloadAttachment methods.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
attachmentIdstringID of attachment
emailIdstringID of email
options?any-

Returns: Promise<AttachmentMetaData>


getAttachments1

getAttachments1(emailId: string, options?: any): Promise<AttachmentMetaData[]>

Defined in src/generated/api.ts:13329

Returns an array of attachment metadata such as name and content-type for a given email if present.

summary Get all email attachment metadata. Metadata includes name and size of attachments.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email
options?any-

Returns: Promise<AttachmentMetaData[]>


getEmail

getEmail(emailId: string, decode?: boolean, options?: any): Promise<Email>

Defined in src/generated/api.ts:13345

Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints

summary Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringemailId
decode?boolean-
options?any-

Returns: Promise<Email>


getEmailContentMatch

getEmailContentMatch(contentMatchOptions: ContentMatchOptions, emailId: string, options?: any): Promise<EmailContentMatchResult>

Defined in src/generated/api.ts:13362

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.

summary Get email content regex pattern match results. Runs regex against email body and returns match groups.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
contentMatchOptionsContentMatchOptionscontentMatchOptions
emailIdstringID of email to match against
options?any-

Returns: Promise<EmailContentMatchResult>


getEmailHTML

getEmailHTML(emailId: string, decode?: boolean, options?: any): Promise

Defined in src/generated/api.ts:13383

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

summary Get email content as HTML. For displaying emails in browser context.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringemailId
decode?boolean-
options?any-

Returns: Promise


getEmailHTMLQuery

getEmailHTMLQuery(emailId: string, htmlSelector?: string, options?: any): Promise<EmailTextLinesResult>

Defined in src/generated/api.ts:13400

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

summary Parse and return text from an email, stripping HTML and decoding encoded characters

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email to perform HTML query on
htmlSelector?string-
options?any-

Returns: Promise<EmailTextLinesResult>


getEmailTextLines

getEmailTextLines(emailId: string, decodeHtmlEntities?: boolean, lineSeparator?: string, options?: any): Promise<EmailTextLinesResult>

Defined in src/generated/api.ts:13422

Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators.

summary Parse and return text from an email, stripping HTML and decoding encoded characters

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email to fetch text for
decodeHtmlEntities?boolean-
lineSeparator?string-
options?any-

Returns: Promise<EmailTextLinesResult>


getEmailsPaginated

getEmailsPaginated(inboxId?: Array, page?: number, size?: number, sort?: “ASC” | “DESC”, unreadOnly?: boolean, options?: any): Promise<PageEmailProjection>

Defined in src/generated/api.ts:13448

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

summary Get all emails in all inboxes in paginated form. Email API list all.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameType
inboxId?Array
page?number
size?number
sort?“ASC”
unreadOnly?boolean
options?any

Returns: Promise<PageEmailProjection>


getLatestEmail

getLatestEmail(inboxIds?: Array, options?: any): Promise<Email>

Defined in src/generated/api.ts:13474

Get the newest email in all inboxes or in a passed set of inbox IDs

summary Get latest email in all inboxes. Most recently received.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameType
inboxIds?Array
options?any

Returns: Promise<Email>


getLatestEmailInInbox

getLatestEmailInInbox(inboxId?: string, options?: any): Promise<Email>

Defined in src/generated/api.ts:13489

Get the newest email in all inboxes or in a passed set of inbox IDs

summary Get latest email in an inbox. Use WaitForController to get emails that may not have arrived yet.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameType
inboxId?string
options?any

Returns: Promise<Email>


getOrganizationEmailsPaginated

getOrganizationEmailsPaginated(inboxId?: Array, page?: number, size?: number, sort?: “ASC” | “DESC”, unreadOnly?: boolean, options?: any): Promise<PageEmailProjection>

Defined in src/generated/api.ts:13508

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

summary Get all organization emails. List team or shared test email accounts

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameType
inboxId?Array
page?number
size?number
sort?“ASC”
unreadOnly?boolean
options?any

Returns: Promise<PageEmailProjection>


getRawEmailContents

getRawEmailContents(emailId: string, options?: any): Promise

Defined in src/generated/api.ts:13536

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

summary Get raw email string. Returns unparsed raw SMTP message with headers and body.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email
options?any-

Returns: Promise


getRawEmailJson

getRawEmailJson(emailId: string, options?: any): Promise<RawEmailJson>

Defined in src/generated/api.ts:13551

Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response

summary Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email
options?any-

Returns: Promise<RawEmailJson>


getUnreadEmailCount

getUnreadEmailCount(options?: any): Promise<UnreadCount>

Defined in src/generated/api.ts:13565

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

summary Get unread email count

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameType
options?any

Returns: Promise<UnreadCount>


replyToEmail

replyToEmail(emailId: string, replyToEmailOptions: ReplyToEmailOptions, options?: any): Promise<SentEmailDto>

Defined in src/generated/api.ts:13580

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.

summary Reply to an email

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of the email that should be replied to
replyToEmailOptionsReplyToEmailOptionsreplyToEmailOptions
options?any-

Returns: Promise<SentEmailDto>


validateEmail

validateEmail(emailId: string, options?: any): Promise<ValidationDto>

Defined in src/generated/api.ts:13600

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

summary Validate email HTML contents

throws {RequiredError}

memberof EmailControllerApi

Parameters:

NameTypeDescription
emailIdstringID of email
options?any-

Returns: Promise<ValidationDto>