ImapClient class Null safety

Low-level IMAP library.

Compliant to IMAP4rev1 standard RFC 3501. Also compare recommendations at RFC 2683

Constructors

ImapClient({EventBus? bus, bool isLogEnabled = false, String? logName, Duration? connectionTimeout, bool onBadCertificate(X509Certificate)?})
Creates a new ImapClient instance. [...]

Properties

connectionInfo ↔ ConnectionInfo
read / write, inherited
connectionTimeout Duration?
final, inherited
eventBus EventBus
Allows to listens for events [...]
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
isLogEnabled bool
read / write, inherited
isLoggedIn bool
read / write, inherited
isSocketClosingExpected bool
read / write, inherited
logName String?
read / write, inherited
onBadCertificate → (bool Function?(X509Certificate)?)
onBadCertificate is an optional handler for unverifiable certificates. The handler receives the X509Certificate, and can inspect it and decide (or let the user decide) whether to accept the connection or not. The handler should return true to continue the SecureSocket connection.
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
serverInfo ImapServerInfo
Information about the IMAP service
read-only

Methods

appendMessage(MimeMessage message, {List<String>? flags, Mailbox? targetMailbox, String? targetMailboxPath}) Future<GenericImapResult>
Appends the specified MIME message. [...]
appendMessageText(String messageText, {List<String>? flags, Mailbox? targetMailbox, String? targetMailboxPath}) Future<GenericImapResult>
Appends the specified MIME messageText. [...]
authenticateWithOAuth2(String user, String accessToken) Future<GenericImapResult>
Logs in the user with the given user and accessToken via Oauth 2.0. [...]
authenticateWithOAuthBearer(String user, String accessToken, {String? host, int? port}) Future<GenericImapResult>
Logs in the user with the given user and accessToken via Oauth Bearer mechanism. [...]
capability() Future<List<Capability>>
Checks the capabilities of this server directly
check() Future<Mailbox>
Trigger a check operation for the server's housekeeping. [...]
closeConnection() Future
Closes the connection. Deprecated: use disconnect() instead.
@Deprecated('Use disconnect() instead.')
closeMailbox() Future<Mailbox?>
Closes the currently selected mailbox and triggers an implicit EXPUNGE. [...]
connect(Socket socket, {ConnectionInfo? connectionInformation}) → void
Starts to liste on socket. [...]
inherited
connectToServer(String host, int port, {bool isSecure = true}) Future<ConnectionInfo>
Connects to the specified server. [...]
inherited
copy(MessageSequence sequence, {Mailbox? targetMailbox, String? targetMailboxPath}) Future<GenericImapResult>
Copies the specified message(s) from the specified sequence from the currently selected mailbox to the target mailbox. [...]
createMailbox(String path) Future<Mailbox>
Creates a new mailbox with the specified path
deleteMailbox(Mailbox box) Future<Mailbox>
Removes the specified mailbox [...]
disconnect() Future<void>
inherited
enable(List<String> capabilities) Future<List<Capability>>
Enables the specified capabilities. [...]
examineMailbox(Mailbox box, {bool enableCondStore = false, QResyncParameters? qresync}) Future<Mailbox>
Examines the box without selecting it. [...]
expunge() Future<Mailbox>
Expunges (deletes) any messages that are marked as deleted. [...]
fetchMessage(int messageSequenceId, String fetchContentDefinition) Future<FetchImapResult>
Fetches a single message by the given definition. [...]
fetchMessages(MessageSequence sequence, String? fetchContentDefinition, {int? changedSinceModSequence}) Future<FetchImapResult>
Fetches messages by the given definition. [...]
fetchMessagesByCriteria(String fetchIdsAndCriteria) Future<FetchImapResult>
Fetches messages by the specified criteria. [...]
fetchRecentMessages({int messageCount = 30, String criteria = '(FLAGS BODY[])'}) Future<FetchImapResult>
Fetches the specified number of recent messages by the specified criteria. [...]
getMetaData(String entry, {String? mailboxName, int? maxSize, MetaDataDepth? depth}) Future<List<MetaDataEntry>>
Retrieves the specified meta data entry. [...]
getQuota({String quotaRoot = '""'}) Future<QuotaResult>
Retrieves the quota for the user/quotaRoot. [...]
getQuotaRoot({String mailboxName = '""'}) Future<QuotaRootResult>
Retrieves the quota root for the specified mailboxName which defaults to the root "". [...]
idleDone() Future
Stops the IDLE mode, for example after receiving information about a new message. Requires a mailbox to be selected.
idleStart() Future
Switches to IDLE mode. Requires a mailbox to be selected.
listMailboxes({String path = '""', bool recursive = false, List<String>? mailboxPatterns, List<String>? selectionOptions, List<ReturnOption>? returnOptions}) Future<List<Mailbox>>
Lists all mailboxes in the given path. [...]
listMailboxesByReferenceAndName(String referenceName, String mailboxName, [List<String>? mailboxPatterns, List<String>? selectionOptions, List<ReturnOption>? returnOptions]) Future<List<Mailbox>>
Lists all mailboxes in the path referenceName that match the given mailboxName that can contain wildcards. [...]
listSubscribedMailboxes({String path = '""', bool recursive = false}) Future<List<Mailbox>>
Lists all subscribed mailboxes [...]
log(dynamic logObject, {bool isClient = true, String? initial}) → void
inherited
login(String name, String password) Future<List<Capability>>
Logs the specified user in with the given name and password.
logout() Future
Logs the current user out.
markAnswered(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as answered. [...]
markDeleted(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as deleted. [...]
markFlagged(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as flagged. [...]
markForwarded(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as forwarded. [...]
markSeen(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as seen/read. [...]
markUnanswered(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as not answered. [...]
markUndeleted(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as not deleted. [...]
markUnflagged(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as unflagged. [...]
markUnforwarded(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as not forwarded. [...]
markUnseen(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as unseen/unread. [...]
move(MessageSequence sequence, {Mailbox? targetMailbox, String? targetMailboxPath}) Future<GenericImapResult>
Moves the specified message(s) from the specified sequence from the currently selected mailbox to the target mailbox. [...]
nextId() String
noop() Future<Mailbox>
Trigger a noop (no operation). [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onCommandResult(ImapResponse imapResponse) → void
onConnectionDone() → void
inherited
onConnectionError(dynamic error) → void
onConnectionEstablished(ConnectionInfo connectionInfo, String serverGreeting) → void
onContinuationResponse(ImapResponse imapResponse) → void
onDataReceived(Uint8List data) → void
onServerResponse(ImapResponse imapResponse) → void
onUntaggedResponse(ImapResponse imapResponse) → void
queueTask(CommandTask task) → void
renameMailbox(Mailbox box, String newName) Future<Mailbox>
Renames the specified mailbox [...]
searchMessages([String searchCriteria = 'UNSEEN', List<ReturnOption>? returnOptions]) Future<SearchImapResult>
Searches messages by the given searchCriteria like 'UNSEEN' or 'RECENT' or 'FROM sender@domain.com'. [...]
searchMessagesWithQuery(SearchQueryBuilder query) Future<SearchImapResult>
Searches mesages with the given query.
selectInbox({bool enableCondStore = false, QResyncParameters? qresync}) Future<Mailbox>
Selects the inbox. [...]
selectMailbox(Mailbox box, {bool enableCondStore = false, QResyncParameters? qresync}) Future<Mailbox>
Selects the specified mailbox. [...]
selectMailboxByPath(String path, {bool enableCondStore = false, QResyncParameters? qresync}) Future<Mailbox>
Selects the specified mailbox. [...]
sendCommand<T>(Command command, ResponseParser<T> parser, {bool returnCompleter = true}) Future<T>
sendCommandTask<T>(CommandTask<T> task, {bool returnCompleter = true}) Future<T>
setMetaData(MetaDataEntry entry) Future<Mailbox?>
Saves the specified meta data entry. [...]
setMetaDataEntries(List<MetaDataEntry> entries) Future<Mailbox>
Saves the given meta data entries. [...]
setQuota({String quotaRoot = '""', required Map<String, int> resourceLimits}) Future<QuotaResult>
Sets the quota resourceLimits for the the user / quotaRoot. [...]
sortMessages(String sortCriteria, [String searchCriteria = 'ALL', String charset = 'UTF-8', List<ReturnOption>? returnOptions]) Future<SortImapResult>
Sorts messages by the given criteria. [...]
startTls() Future<GenericImapResult>
Upgrades the current insure connection to SSL. [...]
statusMailbox(Mailbox box, List<StatusFlags> flags) Future<Mailbox>
Checks the status of the currently not selected box. [...]
store(MessageSequence sequence, List<String> flags, {StoreAction? action, bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Updates the flags of the message(s) from the specified sequence in the currently selected mailbox. [...]
subscribeMailbox(Mailbox box) Future<Mailbox>
Subscribes the specified mailbox. [...]
threadMessages({String method = 'ORDEREDSUBJECT', String charset = 'UTF-8', required DateTime since, bool threadUids = false}) Future<SequenceNode>
Requests the IDs of message threads starting on since using the given method (defaults to ORDEREDSUBJECT) and charset (defaults to UTF-8). [...]
toString() String
A string representation of this object. [...]
inherited
uidCopy(MessageSequence sequence, {Mailbox? targetMailbox, String? targetMailboxPath}) Future<GenericImapResult>
Copies the specified message(s) from the specified sequence from the currently selected mailbox to the target mailbox. [...]
uidExpunge(MessageSequence sequence) Future<Mailbox>
Expunges (deletes) any messages that are in the specified sequence AND marked as deleted. [...]
uidFetchMessage(int messageUid, String fetchContentDefinition) Future<FetchImapResult>
Fetche a single messages identified by the messageUid [...]
uidFetchMessages(MessageSequence sequence, String? fetchContentDefinition, {int? changedSinceModSequence}) Future<FetchImapResult>
Fetches messages by the given definition. [...]
uidFetchMessagesByCriteria(String fetchIdsAndCriteria) Future<FetchImapResult>
Fetches messages by the specified criteria. [...]
uidMarkAnswered(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as answered. [...]
uidMarkDeleted(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as deleted. [...]
uidMarkFlagged(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as flagged. [...]
uidMarkForwarded(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as forwarded. [...]
uidMarkSeen(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as seen/read. [...]
uidMarkUnanswered(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as not answered. [...]
uidMarkUndeleted(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as not deleted. [...]
uidMarkUnflagged(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as unflagged. [...]
uidMarkUnforwarded(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as not forwarded. [...]
uidMarkUnseen(MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Convenience method for marking the messages from the specified sequence as unseen/unread. [...]
uidMove(MessageSequence sequence, {Mailbox? targetMailbox, String? targetMailboxPath}) Future<GenericImapResult>
Copies the specified message(s) from the specified sequence from the currently selected mailbox to the target mailbox. [...]
uidSearchMessages([String searchCriteria = 'UNSEEN', List<ReturnOption>? returnOptions]) Future<SearchImapResult>
Searches messages by the given searchCriteria like 'UNSEEN' or 'RECENT' or 'FROM sender@domain.com'. Is only supported by servers that expose the UID capability. When augmented with zero or more returnOptions, requests an extended search.
uidSearchMessagesWithQuery(SearchQueryBuilder query) Future<SearchImapResult>
Searches mesages with the given query. Is only supported by servers that expose the UID capability.
uidSortMessages(String sortCriteria, [String searchCriteria = 'ALL', String charset = 'UTF-8', List<ReturnOption>? returnOptions]) Future<SortImapResult>
Sorts messages by the given criteria [...]
uidStore(MessageSequence sequence, List<String> flags, {StoreAction? action, bool? silent, int? unchangedSinceModSequence}) Future<StoreImapResult>
Updates the flags of the message(s) from the specified sequence in the currently selected mailbox. [...]
uidThreadMessages({String method = 'ORDEREDSUBJECT', String charset = 'UTF-8', required DateTime since}) Future<SequenceNode>
Requests the UIDs of message threads starting on since using the given method (defaults to ORDEREDSUBJECT) and charset (defaults to UTF-8). [...]
unselectMailbox() Future<void>
Closes the currently selected mailbox without triggering the expunge events. [...]
unsubscribeMailbox(Mailbox box) Future<Mailbox>
Unsubscribes the specified mailbox. [...]
upradeToSslSocket() Future<void>
inherited
writeData(List<int> data, [dynamic logObject]) Future
Writes the specified data. [...]
inherited
writeText(String text, [dynamic logObject]) Future
Writes the specified text. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited