uidSearchMessages method
Future<SearchImapResult>
uidSearchMessages({
- String searchCriteria = 'UNSEEN',
- List<
ReturnOption> ? returnOptions, - Duration? responseTimeout,
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.
This request times out after the specified responseTimeout
Implementation
Future<SearchImapResult> uidSearchMessages({
String searchCriteria = 'UNSEEN',
List<ReturnOption>? returnOptions,
Duration? responseTimeout,
}) {
final parser = SearchParser(
isUidSearch: true,
isExtended: returnOptions != null,
);
final buffer = StringBuffer('UID SEARCH ');
if (returnOptions != null) {
buffer
..write('RETURN (')
..write(returnOptions.join(' '))
..write(') ');
}
buffer.write(searchCriteria);
final cmdText = buffer.toString();
buffer.clear();
final cmd = _commandWithLiterals(cmdText, responseTimeout: responseTimeout);
return sendCommand<SearchImapResult>(cmd, parser);
}