颤振消息未发送

时间:2021-03-10 12:55:14

标签: flutter dart flutter-dependencies mailer

大家好,
С你能帮我为什么邮件不通过吗?
请帮帮我!

也许某个地方需要修复一些东西?

sendMail() async {
  String username = 'myMail@gmail.com';
  String password = '**********';

  final smtpServer = gmail(username, password); 
  final message = Message()
    ..from = Address(username, 'My Name')
    ..recipients.add('myMail@gmail.com')
    //..ccRecipients.addAll(['destCc1@example.com', 'destCc2@example.com'])
   // ..bccRecipients.add(Address('bccAddress@example.com'))
    ..subject = 'Test Dart Mailer library :: ? :: ${DateTime.now()}'
    ..text = 'This is the plain text.\nThis is line 2 of the text part.'
    ..html = "<h1>Test</h1>\n<p>Hey! Here's some HTML content</p>";

  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}');
    }
  }
}

控制台

> D/libc-netbsd(29684): getaddrinfo: smtp.gmail.com get result from
> proxy gai_error = 0 I/flutter (29684): Message not sent.

0 个答案:

没有答案