sendChunkedMessage method Null safety

Future<SmtpResponse> sendChunkedMessage(
  1. MimeMessage message,
  2. {bool use8BitEncoding = false,
  3. MailAddress? from,
  4. List<MailAddress>? recipients}

Sends the specified message using the BDAT SMTP command.

BDATA is supported when the SMTP server announces the CHUNKING capability in its EHLO response. You can query SmtpServerInfo.supportsChunking for this. Set use8BitEncoding to true for sending a UTF-8 encoded message body. Specify from in case the originator is different from the From header in the message. Optionally specify the recipients, in which case the recipients defined in the message are ignored.


Future<SmtpResponse> sendChunkedMessage(
  MimeMessage message, {
  bool use8BitEncoding = false,
  MailAddress? from,
  List<MailAddress>? recipients,
}) {
  final recipientEmails = recipients != null
      ? =>
      : message.recipientAddresses;
  if (recipientEmails.isEmpty) {
    throw SmtpException(this, SmtpResponse(['500 no recipients']));
  return sendCommand(SmtpSendBdatMailCommand(
      message, use8BitEncoding, from, recipientEmails));