MailSlurpAPI.Api.EmailController (mailslurp v11.6.10)

API calls for all endpoints tagged EmailController.

Link to this section Summary

Functions

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

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

Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints. 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 as base64 encoded string (alternative to binary responses) 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.

Forward email Forward an existing email to new recipients.

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

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

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

Get email content regex pattern match results. Runs regex against email body and returns match groups. 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.

Get email content as HTML 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

Parse and return text from an email, stripping HTML and decoding encoded characters 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 Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators.

Get all emails 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 latest email Get the newest email in all inboxes or in a passed set of inbox IDs

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

Get all organization emails 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 raw email 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 in JSON 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 unread email count Get number of emails unread

Reply to an email 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.

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

Link to this section Functions

Link to this function

delete_all_emails(connection, opts \\ [])

Specs

delete_all_emails(Tesla.Env.client(), keyword()) ::
  {:ok, nil} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

delete_email(connection, email_id, opts \\ [])

Specs

delete_email(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email to delete
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

download_attachment(connection, attachment_id, email_id, opts \\ [])

Specs

download_attachment(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • attachment_id (String.t): ID of attachment
  • email_id (String.t): ID of email
  • opts (KeywordList): [optional] Optional parameters
    • :api_key (String.t): Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.

      Returns

} on success {:error, info} on failure

Link to this function

download_attachment_base64(connection, attachment_id, email_id, opts \\ [])

Specs

download_attachment_base64(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, MailSlurpAPI.Model.DownloadAttachmentDto.t()} | {:error, Tesla.Env.t()}

Get email attachment as base64 encoded string (alternative to binary responses) 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.

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • attachment_id (String.t): ID of attachment
  • email_id (String.t): ID of email
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

forward_email(connection, email_id, forward_email_options, opts \\ [])

Specs

forward_email(
  Tesla.Env.client(),
  String.t(),
  MailSlurpAPI.Model.ForwardEmailOptions.t(),
  keyword()
) :: {:ok, nil} | {:error, Tesla.Env.t()}

Forward email Forward an existing email to new recipients.

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email
  • forward_email_options (ForwardEmailOptions): forwardEmailOptions
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

get_attachment_meta_data(connection, attachment_id, email_id, opts \\ [])

Specs

get_attachment_meta_data(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, MailSlurpAPI.Model.AttachmentMetaData.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • attachment_id (String.t): ID of attachment
  • email_id (String.t): ID of email
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

get_attachments(connection, email_id, opts \\ [])

Specs

get_attachments(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, [MailSlurpAPI.Model.AttachmentMetaData.t()]} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email
  • opts (KeywordList): [optional] Optional parameters

    Returns

, ...]} on success {:error, info} on failure

Link to this function

get_email(connection, email_id, opts \\ [])

Specs

get_email(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, MailSlurpAPI.Model.Email.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): emailId
  • opts (KeywordList): [optional] Optional parameters
    • :decode (boolean()): Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance =D7). This can be a pain for testing

      Returns

} on success {:error, info} on failure

Link to this function

get_email_content_match(connection, email_id, content_match_options, opts \\ [])

Specs

Get email content regex pattern match results. Runs regex against email body and returns match groups. 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.

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email to match against
  • content_match_options (ContentMatchOptions): contentMatchOptions
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

get_email_html(connection, email_id, opts \\ [])

Specs

get_email_html(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, Tesla.Env.t()}

Get email content as HTML 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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): emailId
  • opts (KeywordList): [optional] Optional parameters
    • :decode (boolean()): decode

      Returns

} on success {:error, info} on failure

Link to this function

get_email_html_query(connection, email_id, opts \\ [])

Specs

get_email_html_query(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, MailSlurpAPI.Model.EmailTextLinesResult.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email to perform HTML query on
  • opts (KeywordList): [optional] Optional parameters

} on success {:error, info} on failure

Link to this function

get_email_text_lines(connection, email_id, opts \\ [])

Specs

get_email_text_lines(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, MailSlurpAPI.Model.EmailTextLinesResult.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email to fetch text for
  • opts (KeywordList): [optional] Optional parameters
    • :decode_html_entities (boolean()): Decode HTML entities
    • :line_separator (String.t): Line separator character

      Returns

} on success {:error, info} on failure

Link to this function

get_emails_paginated(connection, opts \\ [])

Specs

get_emails_paginated(Tesla.Env.client(), keyword()) ::
  {:ok, MailSlurpAPI.Model.PageEmailProjection.t()} | {:error, Tesla.Env.t()}

Get all emails 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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :inbox_id ([String.t]): Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.
    • :page (integer()): Optional page index in email list pagination
    • :size (integer()): Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results
    • :sort (String.t): Optional createdAt sort direction ASC or DESC
    • :unread_only (boolean()): Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly

      Returns

} on success {:error, info} on failure

Link to this function

get_latest_email(connection, opts \\ [])

Specs

get_latest_email(Tesla.Env.client(), keyword()) ::
  {:ok, MailSlurpAPI.Model.Email.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :inbox_ids ([String.t]): Optional set of inboxes to filter by. Only get the latest email from these inbox IDs

      Returns

} on success {:error, info} on failure

Link to this function

get_latest_email_in_inbox(connection, opts \\ [])

Specs

get_latest_email_in_inbox(Tesla.Env.client(), keyword()) ::
  {:ok, MailSlurpAPI.Model.Email.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :inbox_id (String.t): ID of the inbox you want to get the latest email from

      Returns

} on success {:error, info} on failure

Link to this function

get_organization_emails_paginated(connection, opts \\ [])

Specs

get_organization_emails_paginated(Tesla.Env.client(), keyword()) ::
  {:ok, MailSlurpAPI.Model.PageEmailProjection.t()} | {:error, Tesla.Env.t()}

Get all organization emails 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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :inbox_id ([String.t]): Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.
    • :page (integer()): Optional page index in email list pagination
    • :size (integer()): Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results
    • :sort (String.t): Optional createdAt sort direction ASC or DESC
    • :unread_only (boolean()): Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly

      Returns

} on success {:error, info} on failure

Link to this function

get_raw_email_contents(connection, email_id, opts \\ [])

Specs

get_raw_email_contents(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, Tesla.Env.t()}

Get raw email 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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

get_raw_email_json(connection, email_id, opts \\ [])

Specs

get_raw_email_json(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, MailSlurpAPI.Model.RawEmailJson.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

get_unread_email_count(connection, opts \\ [])

Specs

get_unread_email_count(Tesla.Env.client(), keyword()) ::
  {:ok, MailSlurpAPI.Model.UnreadCount.t()} | {:error, Tesla.Env.t()}

Get unread email count Get number of emails unread

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

reply_to_email(connection, email_id, reply_to_email_options, opts \\ [])

Specs

Reply to an email 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.

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of the email that should be replied to
  • reply_to_email_options (ReplyToEmailOptions): replyToEmailOptions
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure

Link to this function

validate_email(connection, email_id, opts \\ [])

Specs

validate_email(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, MailSlurpAPI.Model.ValidationDto.t()} | {:error, Tesla.Env.t()}

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

Parameters

  • connection (MailSlurpAPI.Connection): Connection to server
  • email_id (String.t): ID of email
  • opts (KeywordList): [optional] Optional parameters

    Returns

} on success {:error, info} on failure