Class ImapStore

java.lang.Object
com.codename1.backend.mail.store.ImapStore
All Implemented Interfaces:
MailReceiver

public final class ImapStore extends Object implements MailReceiver

An IMAP4rev1 mailbox (RFC 3501): the small part of it a reader needs.

  • Sign-in with LOGIN, AUTHENTICATE PLAIN or AUTHENTICATE XOAUTH2 (when cn1.mail.store.accessToken is set), and only over TLS unless allowInsecureAuth is set.
  • STARTTLS, with injected cleartext refused as in SMTP.
  • fetch(String, boolean) selects the folder, runs UID SEARCH UNSEEN NOT DELETED or UID SEARCH NOT DELETED and then UID FETCH <uid> BODY.PEEK[] per message, which leaves its read mark alone; markSeen(String) sets it.
  • markSeen(String) and delete(String) act on the folder of the last fetch(String, boolean). delete(String) flags the message \Deleted. When the server advertises UIDPLUS (RFC 4315) it then removes that message alone with UID EXPUNGE <uid>. Without UIDPLUS the message is only flagged: a bare EXPUNGE would also remove every message another client flagged \Deleted and has not yet expunged. It is removed when close() ends the session (IMAP CLOSE), when a fetch(String, boolean) of another folder closes this one, or when expunge() 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.maxMessageSize is 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.