Interface MailReceiver
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 TypeMethodDescriptionvoidclose()Signs out and closes the connection.voidDeletes a fetched message.The messages offolder(INBOXfor POP3, which has no other), in the server's order.voidMarks a fetched message read.
-
Method Details
-
fetch
The messages offolder(INBOXfor POP3, which has no other), in the server's order. WithunseenOnly, only those not yet marked seen; POP3 keeps no such mark and answers every message.- Throws:
IOException
-
markSeen
Marks a fetched message read. POP3 has no read mark, so there this does nothing.- Throws:
IOException
-
delete
Deletes a fetched message. POP3 removes it when the session closes cleanly; IMAP removes it at once.- Throws:
IOException
-
close
Signs out and closes the connection. Calling it again does nothing.- Throws:
IOException
-