Interface MailReader

All Known Implementing Classes:
DefaultMailReader, ExchangeMailReader, ImapMailReader

public interface MailReader
Author:
Joern Muehlencord (joern@muehlencord.de)
  • Method Details

    • connect

      void connect() throws MailReaderConnectionException
      connects to the mailbox
      Throws:
      MailReaderConnectionException - if he connection cannot be established
    • disconnect

      void disconnect()
      disconnects from mailbox
    • getDefaultFolder

      String getDefaultFolder() throws MailReaderException
      returns the default folder
      Returns:
      the default folder
      Throws:
      MailReaderException - if the folder cannot be retrieved
    • getSubFolder

      List<String> getSubFolder(String sourceFolder) throws MailReaderException
      returns the list of subfolders of the specified source folder
      Parameters:
      sourceFolder - the folder to return the folder list for
      Returns:
      the list of subfolders of the specified source folder
      Throws:
      MailReaderException - if the folder list cannot be retrieved
    • getFolder

      String getFolder(String folderPath) throws MailReaderException
      returns the folder, if folder path is a valid path to an existing folder
      Parameters:
      folderPath - the folder to return
      Returns:
      the folder, if folder path is a valid path to an existing folder
      Throws:
      MailReaderException - if the folder cannot be found
    • getMessageCount

      int getMessageCount(String holdFolder) throws MailReaderException
      returns the amount of message in the given folder
      Parameters:
      holdFolder - the folder to return the amount of messages for
      Returns:
      the amount of message in the given folder
      Throws:
      MailReaderException - if the folder cannot be accessed or the amount of messages cannot be determined
    • getMessages

      List<MailMessage> getMessages(String folder) throws MailReaderException
      retrieves the list of messages stored in the given folder
      Parameters:
      folder - the folder to search return the emails for
      Returns:
      list of messages stored in the given folder
      Throws:
      MailReaderException - if the message list cannot be retrieved
    • getMessages

      List<MailMessage> getMessages(String folder, int start, int end) throws MailReaderException
      retrieves the list of messages stored in the given folder
      Parameters:
      folder - the folder to search return the emails for
      start - the number of the first message
      end - the number of the last message
      Returns:
      list of messages stored in the given folder
      Throws:
      MailReaderException - if the message list cannot be retrieved
    • copyMessage

      void copyMessage(MailMessage mm, String sourceFolder, String destFolder) throws MailReaderException
      copies the given message from the source folder to the destination folder
      Parameters:
      mm - the message to copy
      sourceFolder - the folder the message currently resists in
      destFolder - the folder the message should be copied to
      Throws:
      MailReaderException - if the operation fails
    • moveMessage

      void moveMessage(MailMessage mm, String sourceFolder, String destFolder) throws MailReaderException
      moves the given message from the source folder to the destination folder
      Parameters:
      mm - the message to move
      sourceFolder - the folder the message currently resists in
      destFolder - the folder the message should be moved to
      Throws:
      MailReaderException - if the operation fails
    • setSeenFlag

      void setSeenFlag(String folder, MailMessage mm, boolean flagValue) throws MailReaderException
      marks the messages as seen
      Parameters:
      folder - the folder to search for the email
      mm - the message to mark as seen
      flagValue - if set to true, the seen flag is set; otherwise it is removed (unset)
      Throws:
      MailReaderException - if the flag cannot be set