Package com.mailosaur

Class Messages

java.lang.Object
com.mailosaur.Messages

public class Messages extends Object
An instance of this class provides access to all the operations defined in Messages.
  • Constructor Details

    • Messages

      public Messages(MailosaurClient client)
      Initializes an instance of Messages.
      Parameters:
      client - the instance of the client containing this operation class.
  • Method Details

    • get

      Retrieve a message using search criteria. Returns as soon as an message matching the specified search criteria is found.
      Parameters:
      params - Message searching parameters.
      criteria - The search criteria to match results against.
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • get

      @Deprecated public Message get(String server, SearchCriteria criteria) throws IOException, MailosaurException
      Retrieve a message using search criteria. Returns as soon as an message matching the specified search criteria is found.
      Parameters:
      server - The identifier of the server hosting the message.
      criteria - The search criteria to use in order to find a match.
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • get

      @Deprecated public Message get(String server, SearchCriteria criteria, int timeout) throws IOException, MailosaurException
      Retrieve a message using search criteria. Returns as soon as an message matching the specified search criteria is found.
      Parameters:
      server - The identifier of the server hosting the message.
      criteria - The search criteria to use in order to find a match.
      timeout - Specify how long to wait for a matching result (in milliseconds).
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • get

      @Deprecated public Message get(String server, SearchCriteria criteria, long receivedAfter) throws IOException, MailosaurException
      Retrieve a message using search criteria. Returns as soon as an message matching the specified search criteria is found.
      Parameters:
      server - The identifier of the server hosting the message.
      criteria - The search criteria to use in order to find a match.
      receivedAfter - Limits results to only messages received after this timestamp.
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • get

      @Deprecated public Message get(String server, SearchCriteria criteria, Integer timeout, long receivedAfter) throws IOException, MailosaurException
      Retrieve a message using search criteria. Returns as soon as an message matching the specified search criteria is found.
      Parameters:
      server - The identifier of the server hosting the message.
      criteria - The search criteria to use in order to find a match.
      timeout - Specify how long to wait for a matching result (in milliseconds).
      receivedAfter - Limits results to only messages received after this timestamp.
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • getById

      public Message getById(String id) throws MailosaurException, IOException
      Retrieve an message. Retrieves the detail for a single message. Simply supply the unique identifier for the required message.
      Parameters:
      id - The identifier of the message to be retrieved.
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • delete

      public void delete(String id) throws MailosaurException
      Delete an message. Permanently deletes an message. This operation cannot be undone. Also deletes any attachments related to the message.
      Parameters:
      id - The identifier of the message to be deleted.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation
      MailosaurException - Thrown if Mailosaur responds with an error.
    • deleteAll

      public void deleteAll(String server) throws MailosaurException
      Delete all messages. Permanently deletes all messages held by the specified server. This operation cannot be undone. Also deletes any attachments related to each message.
      Parameters:
      server - The identifier of the server to be emptied.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
    • list

      List all messages. Returns a list of your messages. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      params - Message listing parameters.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • list

      Deprecated.
      List all messages. Returns a list of your messages. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • list

      @Deprecated public MessageListResult list(String server, long receivedAfter) throws IOException, MailosaurException
      Deprecated.
      List all messages. Returns a list of your messages. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      receivedAfter - Limits results to only messages received after this timestamp.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • list

      @Deprecated public MessageListResult list(String server, int page, int itemsPerPage) throws IOException, MailosaurException
      Deprecated.
      List all messages. Returns a list of your messages. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      page - Used in conjunction with `itemsPerPage` to support pagination.
      itemsPerPage - A limit on the number of results to be returned per page. Can be set between 1 and 1000 items, the default is 50.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • list

      @Deprecated public MessageListResult list(String server, Integer page, Integer itemsPerPage, long receivedAfter) throws IOException, MailosaurException
      Deprecated.
      List all messages. Returns a list of your messages. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      page - Used in conjunction with `itemsPerPage` to support pagination.
      itemsPerPage - A limit on the number of results to be returned per page. Can be set between 1 and 1000 items, the default is 50.
      receivedAfter - Limits results to only messages received after this timestamp.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      params - Message searching parameters.
      criteria - The search criteria to match results against.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      criteria - The search criteria to match results against.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      @Deprecated public MessageListResult search(String server, SearchCriteria criteria, int page, int itemsPerPage) throws IOException, MailosaurException
      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      criteria - The search criteria to match results against.
      page - Used in conjunction with `itemsPerPage` to support pagination.
      itemsPerPage - A limit on the number of results to be returned per page. Can be set between 1 and 1000 items, the default is 50.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      @Deprecated public MessageListResult search(String server, SearchCriteria criteria, int timeout) throws IOException, MailosaurException
      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      criteria - The search criteria to match results against.
      timeout - Specify how long to wait for a matching result (in milliseconds).
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      @Deprecated public MessageListResult search(String server, SearchCriteria criteria, int timeout, boolean errorOnTimeout) throws IOException, MailosaurException
      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      criteria - The search criteria to match results against.
      timeout - Specify how long to wait for a matching result (in milliseconds).
      errorOnTimeout - When set to false, an error will not be throw if timeout is reached (default: true).
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      @Deprecated public MessageListResult search(String server, SearchCriteria criteria, long receivedAfter) throws IOException, MailosaurException
      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      criteria - The search criteria to match results against.
      receivedAfter - Limits results to only messages received after this timestamp.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      @Deprecated public MessageListResult search(String server, SearchCriteria criteria, int timeout, long receivedAfter) throws IOException, MailosaurException
      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      criteria - The search criteria to match results against.
      timeout - Specify how long to wait for a matching result (in milliseconds).
      receivedAfter - Limits results to only messages received after this timestamp.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      @Deprecated public MessageListResult search(String server, SearchCriteria criteria, int timeout, boolean errorOnTimeout, long receivedAfter) throws IOException, MailosaurException
      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      criteria - The search criteria to match results against.
      timeout - Specify how long to wait for a matching result (in milliseconds).
      errorOnTimeout - When set to false, an error will not be throw if timeout is reached (default: true).
      receivedAfter - Limits results to only messages received after this timestamp.
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • search

      @Deprecated public MessageListResult search(String server, SearchCriteria criteria, Integer page, Integer itemsPerPage, Integer timeout, long receivedAfter, boolean errorOnTimeout) throws IOException, MailosaurException
      Search for messages. Returns a list of messages matching the specified search criteria. The messages are returned sorted by received date, with the most recently-received messages appearing first.
      Parameters:
      server - The identifier of the server hosting the messages.
      criteria - The search criteria to match results against.
      page - Used in conjunction with `itemsPerPage` to support pagination.
      itemsPerPage - A limit on the number of results to be returned per page. Can be set between 1 and 1000 items, the default is 50.
      timeout - Specify how long to wait for a matching result (in milliseconds).
      receivedAfter - Limits results to only messages received after this timestamp.
      errorOnTimeout - When set to false, an error will not be throw if timeout is reached (default: true).
      Returns:
      the MessageListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • create

      public Message create(String server, MessageCreateOptions messageCreateOptions) throws IOException, MailosaurException
      Create a message. Creates a new message that can be sent to a verified email address. This is useful in scenarios where you want an email to trigger a workflow in your product.
      Parameters:
      server - The identifier of the server to create the message in.
      messageCreateOptions - The options with which to create the message.
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • forward

      public Message forward(String id, MessageForwardOptions messageForwardOptions) throws IOException, MailosaurException
      Forward an email. Forwards the specified email to a verified email address.
      Parameters:
      id - The identifier of the email to forward.
      messageForwardOptions - The options with which to forward the email.
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • reply

      public Message reply(String id, MessageReplyOptions messageReplyOptions) throws IOException, MailosaurException
      Reply to an email. Sends a reply to the specified email. This is useful for when simulating a user replying to one of your emails.
      Parameters:
      id - The identifier of the email to reply to.
      messageReplyOptions - The options with which to reply to the email.
      Returns:
      the Message object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.
    • generatePreviews

      public PreviewListResult generatePreviews(String id, PreviewRequestOptions options) throws IOException, MailosaurException
      Generates screenshots of an email rendered in the specified email clients.
      Parameters:
      id - The identifier of the email to preview.
      options - The options with which to generate previews.
      Returns:
      the PreviewListResult object if successful.
      Throws:
      MailosaurException - Thrown if Mailosaur responds with an error.
      IOException - Unexpected exception.