sendMessageData method

Future<SmtpResponse> sendMessageData(
  1. MimeData data,
  2. MailAddress from,
  3. List<MailAddress> recipients, {
  4. bool use8BitEncoding = false,
})

Sends the specified message data from to the recipients.

Set use8BitEncoding to true for sending a UTF-8 encoded message body.

Implementation

Future<SmtpResponse> sendMessageData(
  MimeData data,
  MailAddress from,
  List<MailAddress> recipients, {
  bool use8BitEncoding = false,
}) {
  if (recipients.isEmpty) {
    throw SmtpException(this, SmtpResponse(['500 no recipients']));
  }

  return sendCommand(
    SmtpSendMailDataCommand(
      data,
      from,
      recipients.map((r) => r.email).toList(),
      use8BitEncoding: use8BitEncoding,
    ),
  );
}