Package 

Class EmailControllerApi

    • Constructor Detail

      • EmailControllerApi

        EmailControllerApi(String xApiKey, String basePath)
    • Method Detail

      • deleteAllEmails

         final Unit deleteAllEmails()

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

      • deleteEmail

         final Unit deleteEmail(UUID emailId)

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

        Parameters:
        emailId - ID of email to delete
      • downloadAttachment

         final ByteArray downloadAttachment(UUID emailId, String attachmentId, String apiKey)

        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. 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:
        emailId - ID of email
        attachmentId - ID of attachment
        apiKey - Can pass apiKey in url for this request if you wish to download the file in a browser.
      • downloadAttachmentRequestConfig

         final RequestConfig downloadAttachmentRequestConfig(UUID emailId, String attachmentId, String apiKey)

        To obtain the request config of the operation downloadAttachment

        Parameters:
        emailId - ID of email
        attachmentId - ID of attachment
        apiKey - Can pass apiKey in url for this request if you wish to download the file in a browser.
      • downloadAttachmentBase64

         final DownloadAttachmentDto downloadAttachmentBase64(UUID emailId, String attachmentId)

        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`. 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:
        emailId - ID of email
        attachmentId - ID of attachment
      • downloadBody

         final String downloadBody(UUID emailId)

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

        Parameters:
        emailId - ID of email
      • downloadBodyBytes

         final ByteArray downloadBodyBytes(UUID emailId)

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

        Parameters:
        emailId - ID of email
      • forwardEmail

         final SentEmailDto forwardEmail(UUID emailId, ForwardEmailOptions forwardEmailOptions)

        Forward email to recipients 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.

        Parameters:
        emailId - ID of email
      • getAttachmentMetaData

         final AttachmentMetaData getAttachmentMetaData(UUID emailId, String attachmentId)

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

        Parameters:
        emailId - ID of email
        attachmentId - ID of attachment
      • getAttachments

         final List<AttachmentMetaData> getAttachments(UUID emailId)

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

        Parameters:
        emailId - ID of email
      • getEmail

         final Email getEmail(UUID emailId, Boolean decode)

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

        Parameters:
        decode - Decode email body quoted-printable encoding to plain text.
      • getEmailRequestConfig

         final RequestConfig getEmailRequestConfig(UUID emailId, Boolean decode)

        To obtain the request config of the operation getEmail

        Parameters:
        decode - Decode email body quoted-printable encoding to plain text.
      • getEmailContentMatch

         final EmailContentMatchResult getEmailContentMatch(UUID emailId, ContentMatchOptions contentMatchOptions)

        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 &#x60;/&#x60; at start or end of regex in some languages. Given an example &#x60;your code is: 12345&#x60; the pattern to extract match looks like &#x60;code is: (\\d{6})&#x60;. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: &#x60;&#39;code is: 123456&#39;, &#39;123456&#39;&#x60; See https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns.

        Parameters:
        emailId - ID of email to match against
      • getEmailHTML

         final String getEmailHTML(UUID emailId, Boolean decode)

        Get email content as HTML. For displaying emails in browser context. 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: &#x60;?apiKey&#x3D;xxx&#x60;

        Parameters:
        decode - (optional, default to false)
      • getEmailHTMLQuery

         final EmailTextLinesResult getEmailHTMLQuery(UUID emailId, String htmlSelector)

        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:
        emailId - ID of email to perform HTML query on
        htmlSelector - HTML selector to search for.
      • getEmailHTMLQueryRequestConfig

         final RequestConfig getEmailHTMLQueryRequestConfig(UUID emailId, String htmlSelector)

        To obtain the request config of the operation getEmailHTMLQuery

        Parameters:
        emailId - ID of email to perform HTML query on
        htmlSelector - HTML selector to search for.
      • getEmailLinks

         final EmailLinksResult getEmailLinks(UUID emailId)

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

        Parameters:
        emailId - ID of email to fetch text for
      • getEmailTextLines

         final EmailTextLinesResult getEmailTextLines(UUID emailId, Boolean decodeHtmlEntities, String lineSeparator)

        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:
        emailId - ID of email to fetch text for
        decodeHtmlEntities - Decode HTML entities (optional)
        lineSeparator - Line separator character (optional)
      • getEmailTextLinesRequestConfig

         final RequestConfig getEmailTextLinesRequestConfig(UUID emailId, Boolean decodeHtmlEntities, String lineSeparator)

        To obtain the request config of the operation getEmailTextLines

        Parameters:
        emailId - ID of email to fetch text for
        decodeHtmlEntities - Decode HTML entities (optional)
        lineSeparator - Line separator character (optional)
      • getEmailsPaginated

         final PageEmailProjection getEmailsPaginated(List<UUID> inboxId, Integer page, Integer size, String sort, Boolean unreadOnly, String searchFilter, OffsetDateTime since, OffsetDateTime before)

        Get all emails in all inboxes in paginated form. Email API list all. 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:
        inboxId - Optional inbox ids to filter by.
        page - Optional page index in email list pagination (optional, default to 0)
        size - Optional page size in email list pagination.
        sort - Optional createdAt sort direction ASC or DESC (optional, default to ASC)
        unreadOnly - Optional filter for unread emails only.
        searchFilter - Optional search filter.
        since - Optional filter emails received after given date time (optional)
        before - Optional filter emails received before given date time (optional)
      • getEmailsPaginatedRequestConfig

         final RequestConfig getEmailsPaginatedRequestConfig(List<UUID> inboxId, Integer page, Integer size, String sort, Boolean unreadOnly, String searchFilter, OffsetDateTime since, OffsetDateTime before)

        To obtain the request config of the operation getEmailsPaginated

        Parameters:
        inboxId - Optional inbox ids to filter by.
        page - Optional page index in email list pagination (optional, default to 0)
        size - Optional page size in email list pagination.
        sort - Optional createdAt sort direction ASC or DESC (optional, default to ASC)
        unreadOnly - Optional filter for unread emails only.
        searchFilter - Optional search filter.
        since - Optional filter emails received after given date time (optional)
        before - Optional filter emails received before given date time (optional)
      • getLatestEmail

         final Email getLatestEmail(Set<UUID> inboxIds)

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

        Parameters:
        inboxIds - Optional set of inboxes to filter by.
      • getLatestEmailInInbox

         final Email getLatestEmailInInbox(UUID inboxId)

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

        Parameters:
        inboxId - ID of the inbox you want to get the latest email from
      • getOrganizationEmailsPaginated

         final PageEmailProjection getOrganizationEmailsPaginated(List<UUID> inboxId, Integer page, Integer size, String sort, Boolean unreadOnly, String searchFilter, OffsetDateTime since, OffsetDateTime before)

        Get all organization emails. List team or shared test email accounts 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:
        inboxId - Optional inbox ids to filter by.
        page - Optional page index in email list pagination (optional, default to 0)
        size - Optional page size in email list pagination.
        sort - Optional createdAt sort direction ASC or DESC (optional, default to ASC)
        unreadOnly - Optional filter for unread emails only.
        searchFilter - Optional search filter search filter for emails.
        since - Optional filter emails received after given date time (optional)
        before - Optional filter emails received before given date time (optional)
      • getOrganizationEmailsPaginatedRequestConfig

         final RequestConfig getOrganizationEmailsPaginatedRequestConfig(List<UUID> inboxId, Integer page, Integer size, String sort, Boolean unreadOnly, String searchFilter, OffsetDateTime since, OffsetDateTime before)

        To obtain the request config of the operation getOrganizationEmailsPaginated

        Parameters:
        inboxId - Optional inbox ids to filter by.
        page - Optional page index in email list pagination (optional, default to 0)
        size - Optional page size in email list pagination.
        sort - Optional createdAt sort direction ASC or DESC (optional, default to ASC)
        unreadOnly - Optional filter for unread emails only.
        searchFilter - Optional search filter search filter for emails.
        since - Optional filter emails received after given date time (optional)
        before - Optional filter emails received before given date time (optional)
      • getRawEmailContents

         final String getRawEmailContents(UUID emailId)

        Get raw email string. Returns unparsed raw SMTP message with headers and body. 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:
        emailId - ID of email
      • getRawEmailJson

         final RawEmailJson getRawEmailJson(UUID emailId)

        Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. 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:
        emailId - ID of email
      • getUnreadEmailCount

         final UnreadCount getUnreadEmailCount()

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

      • markAsRead

         final EmailPreview markAsRead(UUID emailId, Boolean read)

        Mark an email as read on unread 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

        Parameters:
        read - What value to assign to email read property.
      • replyToEmail

         final SentEmailDto replyToEmail(UUID emailId, ReplyToEmailOptions replyToEmailOptions)

        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 &#x60;to&#x60;, &#x60;cc&#x60;, and &#x60;bcc&#x60;.

        Parameters:
        emailId - ID of the email that should be replied to
      • sendEmailSourceOptional

         final Unit sendEmailSourceOptional(UUID inboxId, SendEmailOptions sendEmailOptions, Boolean useDomainPool)

        Send email Alias for &#x60;InboxController.sendEmail&#x60; 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.

        Parameters:
        inboxId - ID of the inbox you want to send the email from
        useDomainPool - Use domain pool.
      • validateEmail

         final ValidationDto validateEmail(UUID emailId)

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

        Parameters:
        emailId - ID of email