Class EmailReader


public class EmailReader extends IntegrationReader
Reads emails (and their attachments) from IMAP mailboxes.
  • Constructor Details

    • EmailReader

      public EmailReader(MailStore mailStore, String host, String user, String password)
      Creates a reader that connects to the mail store's default port.
    • EmailReader

      public EmailReader(MailStore mailStore, String host, int port, String user, String password)
  • Method Details

    • getProperties

      public Properties getProperties()
      Returns the properties used to create the mail session; keys not set here fall back to the system properties.
    • setProperty

      public EmailReader setProperty(String key, String value)
      Sets a property passed to the mail session when the reader is opened.
    • getMailStore

      public MailStore getMailStore()
    • getHost

      public String getHost()
    • getPort

      public int getPort()
    • getUser

      public String getUser()
    • getFolderName

      public String getFolderName()
      Returns the name of the folder to read messages from (default is INBOX).
    • setFolderName

      public EmailReader setFolderName(String folderName)
      Sets the name of the folder to read messages from (default is INBOX).
    • getSearchTerm

      public SearchTerm getSearchTerm()
      Returns the criteria selecting which messages are read or null to read every message in the folder.
    • setSearchTerm

      public EmailReader setSearchTerm(SearchTerm searchTerm)
      Sets the criteria selecting which messages are read; null reads every message in the folder.
    • getDirection

      public EmailReadDirection getDirection()
      Returns the order in which the messages are read (default is FORWARD).
    • setDirection

      public EmailReader setDirection(EmailReadDirection direction)
      Sets the order in which the messages are read; null resets it to FORWARD.
    • isDebug

      public boolean isDebug()
      Indicates if debug mode is turned on for the mail session when the reader opens (default is false).
    • setDebug

      public EmailReader setDebug(boolean debug)
      Indicates if debug mode is turned on for the mail session when the reader opens (default is false).
    • open

      public void open() throws DataException
      Description copied from class: DataEndpoint
      Makes this endpoint ready for reading or writing.
      Overrides:
      open in class IntegrationReader
      Throws:
      DataException
    • close

      public void close() throws DataException
      Description copied from class: DataEndpoint
      Indicates that this endpoint has finished reading or writing.
      Overrides:
      close in class DataEndpoint
      Throws:
      DataException
    • readImpl

      protected Record readImpl() throws Throwable
      Description copied from class: DataReader
      Overridden by subclasses to read the next record from this DataReader. The default implementation of DataReader.read() now insures that this method will not be called again after it returns a null.

      If no record is available, null will be returned.

      Contract for subclasses (see also docs/authoring/DataReader.md):

      Specified by:
      readImpl in class DataReader
      Throws:
      Throwable
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class DataReader