sendMessageBuilder method
Future<void>
sendMessageBuilder(
- MessageBuilder messageBuilder, {
- MailAddress? from,
- bool appendToSent = true,
- Mailbox? sentMailbox,
- List<
MailAddress> ? recipients,
Sends the message defined with the specified messageBuilder
with the recommended text encoding.
Specify from as the originator in case it differs from the
From header of the message.
Optionally set appendToSent to false in case the message should
NOT be appended to the SENT folder.
By default the message is appended. Note that some mail providers
automatically append sent messages to
the SENT folder, this is not detected by this API.
Optionally specify the recipients, in which case the recipients
defined in the message are ignored.
Optionally specify the sentMailbox when the mail system does not
support mailbox flags.
Implementation
Future<void> sendMessageBuilder(
MessageBuilder messageBuilder, {
MailAddress? from,
bool appendToSent = true,
Mailbox? sentMailbox,
List<MailAddress>? recipients,
}) async {
final supports8Bit = await supports8BitEncoding();
final builderEncoding = messageBuilder.setRecommendedTextEncoding(
supports8BitMessages: supports8Bit,
);
final message = messageBuilder.buildMimeMessage();
final use8Bit = builderEncoding == TransferEncoding.eightBit;
return sendMessage(
message,
from: from,
appendToSent: appendToSent,
supportUnicode: supports8Bit,
sentMailbox: sentMailbox,
use8BitEncoding: use8Bit,
recipients: recipients,
);
}