MailSlurp JS

Globals / EmailControllerApi

# Class: EmailControllerApi

EmailControllerApi - object-oriented interface

export

# Hierarchy

# Index

# Constructors

# Properties

# Methods

# Constructors

# constructor

+ new EmailControllerApi(configuration?: Configuration, basePath?: string, fetch?: FetchAPI): EmailControllerApi

Inherited from BaseAPI.constructor

Defined in src/generated/api.ts:57 (opens new window)

# Parameters:

Name Type Default value
configuration? Configuration -
basePath string BASE_PATH
fetch FetchAPI portableFetch

Returns: EmailControllerApi

# Properties

# basePath

Protected basePath: string

Inherited from BaseAPI.basePath

Defined in src/generated/api.ts:61 (opens new window)


# configuration

Protected configuration: Configuration

Inherited from BaseAPI.configuration

Defined in src/generated/api.ts:57 (opens new window)


# fetch

Protected fetch: FetchAPI

Inherited from BaseAPI.fetch

Defined in src/generated/api.ts:62 (opens new window)

# Methods

# deleteAllEmails

deleteAllEmails(options?: any): Promise<Response>

Defined in src/generated/api.ts:8097 (opens new window)

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

summary Delete all emails

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type
options? any

Returns: Promise<Response>


# deleteEmail

deleteEmail(emailId: string, options?: any): Promise<Response>

Defined in src/generated/api.ts:8111 (opens new window)

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

summary Delete an email

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
emailId string ID of email to delete
options? any -

Returns: Promise<Response>


# downloadAttachment

downloadAttachment(attachmentId: string, emailId: string, apiKey?: string, options?: any): Promise&lt;string>

Defined in src/generated/api.ts:8128 (opens new window)

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. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints.

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
attachmentId string ID of attachment
emailId string ID of email
apiKey? string -
options? any -

Returns: Promise&lt;string>


# downloadAttachmentBase64

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

Defined in src/generated/api.ts:8151 (opens new window)

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 (alternative to binary responses)

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
attachmentId string ID of attachment
emailId string ID of email
options? any -

Returns: Promise<DownloadAttachmentDto>


# forwardEmail

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

Defined in src/generated/api.ts:8173 (opens new window)

Forward an existing email to new recipients.

summary Forward email

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
emailId string ID of email
forwardEmailOptions ForwardEmailOptions forwardEmailOptions
options? any -

Returns: Promise<Response>


# getAttachmentMetaData

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

Defined in src/generated/api.ts:8194 (opens new window)

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

summary Get email attachment metadata

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
attachmentId string ID of attachment
emailId string ID of email
options? any -

Returns: Promise<AttachmentMetaData>


# getAttachments

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

Defined in src/generated/api.ts:8214 (opens new window)

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

summary Get all email attachment metadata

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
emailId string ID of email
options? any -

Returns: Promise<AttachmentMetaData[]>


# getEmail

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

Defined in src/generated/api.ts:8230 (opens new window)

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

summary Get email content

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
emailId string emailId
decode? boolean -
options? any -

Returns: Promise<Email>


# getEmailContentMatch

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

Defined in src/generated/api.ts:8247 (opens new window)

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/Pattern.html 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:

Name Type Description
contentMatchOptions ContentMatchOptions contentMatchOptions
emailId string ID of email to match against
options? any -

Returns: Promise<EmailContentMatchResult>


# getEmailHTML

getEmailHTML(emailId: string, decode?: boolean, options?: any): Promise&lt;string>

Defined in src/generated/api.ts:8268 (opens new window)

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

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
emailId string emailId
decode? boolean -
options? any -

Returns: Promise&lt;string>


# getEmailsPaginated

getEmailsPaginated(inboxId?: Array&lt;string>, page?: number, size?: number, sort?: "ASC" | "DESC", unreadOnly?: boolean, options?: any): Promise<PageEmailProjection>

Defined in src/generated/api.ts:8288 (opens new window)

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

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type
inboxId? Array&lt;string>
page? number
size? number
sort? "ASC"
unreadOnly? boolean
options? any

Returns: Promise<PageEmailProjection>


# getRawEmailContents

getRawEmailContents(emailId: string, options?: any): Promise&lt;string>

Defined in src/generated/api.ts:8314 (opens new window)

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

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
emailId string ID of email
options? any -

Returns: Promise&lt;string>


# getRawEmailJson

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

Defined in src/generated/api.ts:8329 (opens new window)

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

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
emailId string ID of email
options? any -

Returns: Promise<RawEmailJson>


# getUnreadEmailCount

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

Defined in src/generated/api.ts:8343 (opens new window)

Get number of emails unread

summary Get unread email count

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type
options? any

Returns: Promise<UnreadCount>


# validateEmail

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

Defined in src/generated/api.ts:8357 (opens new window)

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

summary Validate email

throws {RequiredError}

memberof EmailControllerApi

# Parameters:

Name Type Description
emailId string ID of email
options? any -

Returns: Promise<ValidationDto>