Interface MailReceiver

All Known Implementing Classes:
ImapStore, Pop3Store

public interface MailReceiver

A mailbox read over POP3 or IMAP: MailReceivers.fromConfig(Config) opens one.

A receiver is one session with the mail server, signed in. It is not thread safe; open one per thread that reads mail, and close it when done.

A uid names a message within the folder it was fetched from, and stays valid for as long as the session that fetched it is open.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Signs out and closes the connection.
    void
    Deletes a fetched message.
    fetch(String folder, boolean unseenOnly)
    The messages of folder (INBOX for POP3, which has no other), in the server's order.
    void
    Marks a fetched message read.
  • Method Details

    • fetch

      List<FetchedMail> fetch(String folder, boolean unseenOnly) throws IOException
      The messages of folder (INBOX for POP3, which has no other), in the server's order. With unseenOnly, only those not yet marked seen; POP3 keeps no such mark and answers every message.
      Throws:
      IOException
    • markSeen

      void markSeen(String uid) throws IOException
      Marks a fetched message read. POP3 has no read mark, so there this does nothing.
      Throws:
      IOException
    • delete

      void delete(String uid) throws IOException
      Deletes a fetched message. POP3 removes it when the session closes cleanly; IMAP removes it at once.
      Throws:
      IOException
    • close

      void close() throws IOException
      Signs out and closes the connection. Calling it again does nothing.
      Throws:
      IOException