首页 > 解决方案 > 颤振错误:未处理的异常:将 RCPT 发送到:<> 后,响应没有以任何开头:[2]

问题描述

这是我用来从 Flutter 应用程序发送电子邮件的代码:

final smtpServer = gmail(username, password);
    final message = Message()
      ..from = Address(username, '$name')
      ..recipients.add('pareez.salon@example.com')
      ..ccRecipients.addAll([''])
      ..bccRecipients.add(Address(''))
      ..subject = 'Pareez Salon Booking'
      ..text = '$name  ////   $phoneNo    ////    ${widget.emailText}'
      ..html = "";

    try {
      final sendReport = await send(message, smtpServer);
      print('Message sent: ' + sendReport.toString());
    } on MailerException catch (e) {
      print('Message not sent.');
      for (var p in e.problems) {
        print('Problem: ${p.code}: ${p.msg}');
      }
    }

    var connection = PersistentConnection(smtpServer);
    await connection.send(message);
    await connection.close();
  }

标签: flutterflutter-dependenciesflutter-web

解决方案


推荐阅读