Class ImapStore
java.lang.Object
com.codename1.backend.mail.store.ImapStore
- All Implemented Interfaces:
MailReceiver
An IMAP4rev1 mailbox (RFC 3501): the small part of it a reader needs.
- Sign-in with
LOGIN,AUTHENTICATE PLAINorAUTHENTICATE XOAUTH2(whencn1.mail.store.accessTokenis set), and only over TLS unlessallowInsecureAuthis set. STARTTLS, with injected cleartext refused as in SMTP.fetch(String, boolean)selects the folder, runsUID SEARCH UNSEEN NOT DELETEDorUID SEARCH NOT DELETEDand thenUID FETCH <uid> BODY.PEEK[]per message, which leaves its read mark alone;markSeen(String)sets it.markSeen(String)anddelete(String)act on the folder of the lastfetch(String, boolean).delete(String)flags the message\Deleted. When the server advertises UIDPLUS (RFC 4315) it then removes that message alone withUID EXPUNGE <uid>. Without UIDPLUS the message is only flagged: a bare EXPUNGE would also remove every message another client flagged\Deletedand has not yet expunged. It is removed whenclose()ends the session (IMAPCLOSE), when afetch(String, boolean)of another folder closes this one, or whenexpunge()is called, and each removes every flagged message in the folder. A flagged message is not fetched again meanwhile.- A message larger than
cn1.mail.store.maxMessageSizeis drained from the connection without being kept and listed as skipped (FetchedMail.getSkipped()); the rest of the folder is still read.
A NO or BAD reply is a MailException carrying the server's text.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Signs out and closes the connection.voidDeletes a fetched message.voidexpunge()Removes every message flagged\Deletedin the folder of the lastfetch(String, boolean), including any another client flagged.The messages offolder(INBOXfor POP3, which has no other), in the server's order.voidMarks a fetched message read.static ImapStoreConnects and signs in with thecn1.mail.store.*settingsMailReceiversdocuments.
-
Method Details
-
open
Connects and signs in with thecn1.mail.store.*settingsMailReceiversdocuments.- Throws:
IOException
-
fetch
Description copied from interface:MailReceiverThe 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.- Specified by:
fetchin interfaceMailReceiver- Throws:
IOException
-
markSeen
Description copied from interface:MailReceiverMarks a fetched message read. POP3 has no read mark, so there this does nothing.- Specified by:
markSeenin interfaceMailReceiver- Throws:
IOException
-
delete
Description copied from interface:MailReceiverDeletes a fetched message. POP3 removes it when the session closes cleanly; IMAP removes it at once.- Specified by:
deletein interfaceMailReceiver- Throws:
IOException
-
expunge
Removes every message flagged\Deletedin the folder of the lastfetch(String, boolean), including any another client flagged. Needed only when the server lacks UIDPLUS and the messages must go beforeclose().- Throws:
IOException
-
close
Description copied from interface:MailReceiverSigns out and closes the connection. Calling it again does nothing.- Specified by:
closein interfaceMailReceiver- Throws:
IOException
-