queue method

Future<void> queue()

Implementation

Future<void> queue() async {
  if (_server == null) {
    throw Exception('Mail not configured. Call Mail.setup() first.');
  }

  final mailData = {
    'fromAddress': _fromAddress,
    'fromName': _fromName,
    'to': _to,
    'cc': _cc,
    'bcc': _bcc,
    'subject': _subject,
    'text': _text,
    'html': _html,
  };

  final serverData = {
    'host': _server!.host,
    'port': _server!.port,
    'username': _server!.username,
    'password': _server!.password,
    'ssl': _server!.ssl,
  };

  await Isolate.spawn(_sendInBackground, {
    'message': mailData,
    'server': serverData,
  });
}