MailClient class
Highlevel online API to access mail.
Constructors
- MailClient.new(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
message
to thetargetMailboxF
. -
appendMessageToFlag(
MimeMessage message, MailboxFlag targetMailboxFlag, {List< String> ? flags}) → Future<UidResponseCode?> -
Appends the
message
to the mailbox with thetargetMailboxFlag
. -
buildMimeMessageWithRecommendedTextEncoding(
MessageBuilder messageBuilder) → Future< MimeMessage?> -
Builds the mime message from the given
messageBuilder
with 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
fetchId
of the specifiedmessage
. -
fetchMessages(
{Mailbox? mailbox, int count = 20, int page = 1, FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize}) → Future< List< MimeMessage> > -
Loads the specified
page
of messages starting at the latest message and going downcount
messages. -
fetchMessageSequence(
MessageSequence sequence, {Mailbox? mailbox, FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize, bool markAsSeen = false}) → Future< List< MimeMessage> > -
Loads the specified
sequence
of 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
threadResult
and 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
message
with the specified flags. -
getMailbox(
MailboxFlag flag, [List< Mailbox> ? boxes]) → Mailbox? -
Retrieves the mailbox with the specified
flag
from the providedboxes
. When no boxes are given, then theMailClient.mailboxes
are used. -
isPolling(
) → bool - Checks if this mail client is currently polling.
-
junkMessage(
MimeMessage message) → Future< MoveResult> -
Moves the specified
message
to the junk folder -
junkMessages(
MessageSequence sequence) → Future< MoveResult> -
Moves the specified message
sequence
to 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
sequence
as answered. -
markDeleted(
MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as deleted. -
markFlagged(
MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as flagged. -
markForwarded(
MessageSequence sequence, {bool? silent, int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as forwarded. -
markSeen(
MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as seen/read. -
markUnanswered(
MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as not answered. -
markUndeleted(
MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as not deleted. -
markUnflagged(
MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as unflagged. -
markUnforwarded(
MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as not forwarded. -
markUnseen(
MessageSequence sequence, {int? unchangedSinceModSequence}) → Future< void> -
Convenience method for marking the messages from the specified
sequence
as unseen/unread. -
moveMessage(
MimeMessage message, Mailbox target) → Future< MoveResult> -
Moves the specified
message
to the giventarget
folder -
moveMessages(
MessageSequence sequence, Mailbox target) → Future< MoveResult> -
Moves the specified message
sequence
to the giventarget
folder -
moveMessagesToFlag(
MessageSequence sequence, MailboxFlag flag) → Future< MoveResult> -
Moves the specified message
sequence
to the folder flagged with the specified mailboxflag
. -
moveMessagesToInbox(
MessageSequence sequence) → Future< MoveResult> -
Moves the specified message
sequence
to the inbox folder -
moveMessageToFlag(
MimeMessage message, MailboxFlag flag) → Future< MoveResult> -
Moves the specified
message
to the folder flagged with the specified mailboxflag
. -
moveMessageToInbox(
MimeMessage message) → Future< MoveResult> -
Moves the specified
message
to 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
message
to the drafts mailbox with the\Draft
and\Seen
message 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
messageBuilder
with 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
order
from 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
flags
for 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
\Seen
can 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.isUndoable
istrue
. -
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