fetchMessageSequence method
Future<List<MimeMessage> >
fetchMessageSequence(
- MessageSequence sequence, {
- Mailbox? mailbox,
- FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
- bool markAsSeen = false,
Loads the specified sequence
of messages.
Optionally specify the mailbox
in case none has been selected before or if another mailbox/folder should be queried.
Optionally specify the fetchPreference
to define the preferred downloaded scope, defaults to FetchPreference.fullWhenWithinSize
.
Set markAsSeen
to true
to automatically add the \Seen
flag in case it is not there yet when downloading the fetchPreference.full
.
Note that the preference cannot be realized on some backends such as POP3 mail servers.
Implementation
Future<List<MimeMessage>> fetchMessageSequence(MessageSequence sequence,
{Mailbox? mailbox,
FetchPreference fetchPreference = FetchPreference.fullWhenWithinSize,
bool markAsSeen = false}) async {
mailbox ??= _selectedMailbox;
if (mailbox == null) {
throw StateError('Either specify a mailbox or select a mailbox first');
}
if (mailbox != _selectedMailbox) {
await selectMailbox(mailbox);
}
return _incomingMailClient.fetchMessageSequence(sequence,
fetchPreference: fetchPreference, markAsSeen: markAsSeen);
}