MailClient class
Highlevel online API to access mail.
Constructors
- MailClient(MailAccount account, {bool isLogEnabled = false, int? downloadSizeLimit, EventBus? eventBus, String? logName, bool onBadCertificate(X509Certificate)?})
- 
          Creates a new highlevel online mail client for the given account.
Properties
- account → MailAccount
- 
  
  no setter
- eventBus → EventBus
- 
  event bus for firing and listening to events
  no setter
- hashCode → int
- 
  The hash code for this object.
  no setterinherited
- isConnected → bool
- 
  
  no setter
- lowLevelIncomingMailClient → ClientBase
- 
  Retrieves the low level mail client for reading mails
  no setter
- lowLevelIncomingMailClientType → ServerType
- 
  Retrieves the type pof the low level mail client, currently either ServerType.imap or ServerType.pop
  no setter
- lowLevelOutgoingMailClient → ClientBase
- 
  Retrieves the low level mail client for sending mails
  no setter
- lowLevelOutgoingMailClientType → ServerType
- 
  Retrieves the type pof the low level mail client, currently always ServerType.smtp
  no setter
- 
  mailboxes
  → List<Mailbox> ?
- 
  Retrieves the previously caches mailboxes
  no setter
- runtimeType → Type
- 
  A representation of the runtime type of the object.
  no setterinherited
- selectedMailbox → Mailbox?
- 
  Retrieves the currently selected mailbox, if any.
  no setter
- supportsMailboxes → bool
- 
  Checks if this mail client supports different mailboxes
  no setter
- supportsThreading → bool
- 
  Checks if the connected service supports threading
  no setter
Methods
- 
  addEventFilter(MailEventFilter filter) → void 
- 
  Adds the specified mail event filter.
- 
  appendMessage(MimeMessage message, Mailbox targetMailbox, {List< String> ? flags}) → Future<UidResponseCode?> 
- 
  Appends the messageto thetargetMailboxF.
- 
  appendMessageToFlag(MimeMessage message, MailboxFlag targetMailboxFlag, {List< String> ? flags}) → Future<UidResponseCode?> 
- 
  Appends the messageto the mailbox with thetargetMailboxFlag.
- 
  buildMimeMessageWithRecommendedTextEncoding(MessageBuilder messageBuilder) → Future< MimeMessage?> 
- 
  Builds the mime message from the given messageBuilderwith the recommended text encodings.
- 
  connect() → Future< void> 
- Connects and authenticates with the specified incoming mail server.
- 
  createMailbox(String mailboxName, {Mailbox? parentMailbox}) → Future< Mailbox> 
- 
  Creates a new mailbox with the given mailboxName.
- 
  deleteAllMessages(Mailbox mailbox, {bool? expunge}) → Future< DeleteResult> 
- 
  Deletes all messages from the specified mailbox.
- 
  deleteMailbox(Mailbox mailbox) → Future< void> 
- 
  deleteMessage(MimeMessage message) → Future< DeleteResult> 
- 
  Deletes the given message.
- 
  deleteMessages(MessageSequence sequence) → Future< DeleteResult> 
- 
  Deletes the given message sequence.
- 
  disconnect() → Future 
- Disconnects from the mail service.
- 
  fetchMessageContents(MimeMessage message, {int? maxSize, bool markAsSeen = false, List< MediaToptype> ? includedInlineTypes}) → Future<MimeMessage> 
- 
  Fetches the contents of the specified message.
- 
  fetchMessagePart(MimeMessage message, String fetchId) → Future< MimePart> 
- 
  Fetches the part with the specified fetchIdof the specifiedmessage.
- 
  fetchMessages({Mailbox? mailbox, int count = 20, int page = 1, FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize}) → Future< List< MimeMessage> >
- 
  Loads the specified pageof messages starting at the latest message and going downcountmessages.
- 
  fetchMessageSequence(MessageSequence sequence, {Mailbox? mailbox, FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize, bool markAsSeen = false}) → Future< List< MimeMessage> >
- 
  Loads the specified sequenceof messages.
- 
  fetchMessagesNextPage(PagedMessageSequence pagedSequence, {Mailbox? mailbox, FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize, bool markAsSeen = false}) → Future< List< MimeMessage> >
- 
  Loads the next page of messages in the given pagedSequence.
- 
  fetchNextPage(PagedMessageResult pagedResult) → Future< List< MimeMessage> >
- 
  Retrieves the next page of messages for the specified pagedResult.
- 
  fetchThreadData({Mailbox? mailbox, required DateTime since, bool setThreadSequences = false}) → Future< ThreadDataResult> 
- 
  Retrieves thread information starting at since.
- 
  fetchThreads({Mailbox? mailbox, required DateTime since, ThreadPreference threadPreference = ThreadPreference.latest, FetchPreference fetchPreference = FetchPreference.envelope, int pageSize = 30}) → Future< ThreadResult> 
- 
  Retrieves the threads starting at since.
- 
  fetchThreadsNextPage(ThreadResult threadResult) → Future< List< MimeMessage> >
- 
  Retrieves the next page for the given threadResultand returns the loaded messsages.
- 
  flagMessage(MimeMessage message, {bool? isSeen, bool? isFlagged, bool? isAnswered, bool? isForwarded, bool? isDeleted, bool? isMdnSent, bool? isReadReceiptSent}) → Future< void> 
- 
  Flags the messagewith the specified flags.
- 
  getMailbox(MailboxFlag flag, [List< Mailbox> ? boxes]) → Mailbox?
- 
  Retrieves the mailbox with the specified flagfrom the providedboxes. When no boxes are given, then theMailClient.mailboxesare used.
- 
  isPolling() → bool 
- Checks if this mail client is currently polling.
- 
  junkMessage(MimeMessage message) → Future< MoveResult> 
- 
  Moves the specified messageto the junk folder
- 
  junkMessages(MessageSequence sequence) → Future< MoveResult> 
- 
  Moves the specified message sequenceto the junk folder
- 
  listMailboxes({List< MailboxFlag> ? order}) → Future<List< Mailbox> >
- Lists all mailboxes/folders of the incoming mail server.
- 
  listMailboxesAsTree({bool createIntermediate = true, List< MailboxFlag> order = defaultMailboxOrder}) → Future<Tree< Mailbox?> >
- 
  Lists all mailboxes/folders of the incoming mail server as a tree in the specified order.
- 
  markAnswered(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas answered.
- 
  markDeleted(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas deleted.
- 
  markFlagged(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas flagged.
- 
  markForwarded(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas forwarded.
- 
  markSeen(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas seen/read.
- 
  markUnanswered(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas not answered.
- 
  markUndeleted(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas not deleted.
- 
  markUnflagged(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas unflagged.
- 
  markUnforwarded(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas not forwarded.
- 
  markUnseen(MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> 
- 
  Convenience method for marking the messages from the specified sequenceas unseen/unread.
- 
  moveMessage(MimeMessage message, Mailbox target) → Future< MoveResult> 
- 
  Moves the specified messageto the giventargetfolder
- 
  moveMessages(MessageSequence sequence, Mailbox target) → Future< MoveResult> 
- 
  Moves the specified message sequenceto the giventargetfolder
- 
  moveMessagesToFlag(MessageSequence sequence, MailboxFlag flag) → Future< MoveResult> 
- 
  Moves the specified message sequenceto the folder flagged with the specified mailboxflag.
- 
  moveMessagesToInbox(MessageSequence sequence) → Future< MoveResult> 
- 
  Moves the specified message sequenceto the inbox folder
- 
  moveMessageToFlag(MimeMessage message, MailboxFlag flag) → Future< MoveResult> 
- 
  Moves the specified messageto the folder flagged with the specified mailboxflag.
- 
  moveMessageToInbox(MimeMessage message) → Future< MoveResult> 
- 
  Moves the specified messageto the inbox folder
- 
  noSuchMethod(Invocation invocation) → dynamic 
- 
  Invoked when a nonexistent method or property is accessed.
  inherited
- 
  removeEventFilter(MailEventFilter filter) → void 
- 
  Removes the specified mail event filter.
- 
  resume() → Future< void> 
- Resumes the mail client after a some inactivity.
- 
  saveDraftMessage(MimeMessage message) → Future< UidResponseCode?> 
- 
  Appends the messageto the drafts mailbox with the\Draftand\Seenmessage flags.
- 
  searchMessages(MailSearch search) → Future< MailSearchResult> 
- 
  Searches the messages with the criteria defined in search.
- 
  searchMessagesNextPage(MailSearchResult searchResult) → Future< List< MimeMessage> >
- 
  Retrieves the next page of messages for the specified searchResult.
- 
  selectInbox({bool enableCondstore = false, QResyncParameters? qresync}) → Future< Mailbox> 
- Shortcut to select the INBOX.
- 
  selectMailbox(Mailbox mailbox, {bool enableCondstore = false, QResyncParameters? qresync}) → Future< Mailbox> 
- 
  Selects the specified mailbox/folder.
- 
  selectMailboxByFlag(MailboxFlag flag, {bool enableCondstore = false, QResyncParameters? qresync}) → Future< Mailbox> 
- 
  Selects the mailbox/folder with the specified flag.
- 
  selectMailboxByPath(String path, {bool enableCondstore = false, QResyncParameters? qresync}) → Future< Mailbox> 
- 
  Selects the mailbox/folder with the specified path.
- 
  sendMessage(MimeMessage message, {MailAddress? from, bool appendToSent = true, bool use8BitEncoding = false, List< MailAddress> ? recipients}) → Future<void> 
- 
  Sends the specified message.
- 
  sendMessageBuilder(MessageBuilder messageBuilder, {MailAddress? from, bool appendToSent = true, List< MailAddress> ? recipients}) → Future
- 
  Sends the message defined with the specified messageBuilderwith the recommended text encoding.
- 
  sortMailboxes(List< MailboxFlag> order, List<Mailbox> mailboxes, {bool keepRemaining = true, bool sortRemainingAlphabetically = true}) → List<Mailbox> 
- 
  Retrieves the mailbox with the specified orderfrom the providedmailboxes. The underlying mailboxes are not changed.
- 
  startPolling([Duration duration = defaultPollingDuration]) → Future< void> 
- Starts listening for new incoming messages.
- 
  stopPolling() → Future< void> 
- Stops listening for new messages.
- 
  stopPollingIfNeeded() → Future< void> 
- Stops listening for new messages if this client is currently polling.
- 
  store(MessageSequence sequence, List< String> flags, {StoreAction action = StoreAction.add, int? unchangedSinceModSequence}) → Future<void> 
- 
  Stores the specified message flagsfor the given messagesequence.
- 
  supports8BitEncoding() → Future< bool> 
- Checks if the mail provider supports 8 bit encoded messages for new messages.
- 
  supportsFlagging() → bool 
- 
  Determines if message flags such as \Seencan be stored.
- 
  toString() → String 
- 
  A string representation of this object.
  inherited
- 
  undoDeleteMessages(DeleteResult deleteResult) → Future< DeleteResult> 
- 
  Reverts the previous deleteResult, note that is only possible whendeleteResult.isUndoableistrue.
- 
  undoMoveMessages(MoveResult moveResult) → Future< MoveResult> 
- Reverts the previous move operation, if possible.
Operators
- 
  operator ==(Object other) → bool 
- 
  The equality operator.
  inherited
Constants
- 
    defaultMailboxOrder
  → const List<MailboxFlag> 
- defaultPollingDuration → const Duration