selectInbox method

Future<Mailbox> selectInbox({
  1. bool enableCondStore = false,
  2. QResyncParameters? qresync,
})

Shortcut to select the INBOX.

Optionally specify if CONDSTORE support should be enabled with enableCondStore - for IMAP servers that support CONDSTORE only.

Optionally specify quick resync parameters with qresync - for IMAP servers that support QRESYNC only.

Implementation

Future<Mailbox> selectInbox({
  bool enableCondStore = false,
  QResyncParameters? qresync,
}) async {
  var mailboxes = _mailboxes;
  mailboxes ??= await listMailboxes();
  var inbox = mailboxes.firstWhereOrNull((box) => box.isInbox);
  inbox ??=
      mailboxes.firstWhereOrNull((box) => box.name.toLowerCase() == 'inbox');
  if (inbox == null) {
    throw MailException(this, 'Unable to find inbox');
  }

  return selectMailbox(
    inbox,
    enableCondStore: enableCondStore,
    qresync: qresync,
  );
}