appendMessageText method
Appends the specified MIME messageText.
When no targetMailbox or targetMailboxPath is specified, then the
message will be appended to the currently selected mailbox.
You can specify flags such as \Seen or \Draft in the flags parameter.
Specify a responseTimeout when a response is expected within the
given time.
Compare also the appendMessage method.
Implementation
Future<GenericImapResult> appendMessageText(
String messageText, {
List<String>? flags,
Mailbox? targetMailbox,
String? targetMailboxPath,
Duration? responseTimeout,
}) {
final path = _encodeFirstMailboxPath(
targetMailbox,
targetMailboxPath,
_selectedMailbox,
);
final buffer = StringBuffer()
..write('APPEND ')
..write(path);
if (flags != null && flags.isNotEmpty) {
buffer
..write(' (')
..write(flags.join(' '))
..write(')');
}
final numberOfBytes = utf8.encode(messageText).length;
buffer
..write(' {')
..write(numberOfBytes)
..write('}');
final cmdText = buffer.toString();
final cmd = Command.withContinuation(
[cmdText, messageText],
responseTimeout: responseTimeout,
);
return sendCommand<GenericImapResult>(
cmd,
GenericParser(this, _selectedMailbox),
);
}