微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flutter Web - 无后端 - 如何发送邮件

如何解决Flutter Web - 无后端 - 如何发送邮件

我正在开发一个带有 Flutter web 的网站。 在这个网站上有一个页面可以直接从网站发送电子邮件

为此,我考虑使用 backendlesshttps://backendless.com/docs/flutter/email_settings.html

但是当我发送一封简单的电子邮件时,它给了我以下问题。

Error: PlatformException(error,Expected a value of type '(dynamic) => dynamic',but got one of type '(Object) => Object',null,null)
at Object.throw_ [as throw] (http://localhost:61993/dart_sdk.js:5032:11)
at StandardMethodCodec.decodeEnvelope (http://localhost:61993/packages/Flutter/src/services/system_channels.dart.lib.js:791:19)
at MethodChannel._invokeMethod (http://localhost:61993/packages/Flutter/src/services/system_channels.dart.lib.js:955:47)
at _invokeMethod.next (<anonymous>)
at http://localhost:61993/dart_sdk.js:37210:33
at _RootZone.runUnary (http://localhost:61993/dart_sdk.js:37081:59)
at _FutureListener.thenAwait.handleValue (http://localhost:61993/dart_sdk.js:32337:29)
at handleValueCallback (http://localhost:61993/dart_sdk.js:32864:49)
at Function._propagatetoListeners (http://localhost:61993/dart_sdk.js:32902:17)
at _Future.new.[_completeWithValue] (http://localhost:61993/dart_sdk.js:32750:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:61993/dart_sdk.js:32771:35)
at Object._microtaskLoop (http://localhost:61993/dart_sdk.js:37333:13)
at _startMicrotaskLoop (http://localhost:61993/dart_sdk.js:37339:13)
at http://localhost:61993/dart_sdk.js:33110:9

下面是发送邮件代码

    @override
  void initState() {
    super.initState();
    backendless.initWebApp('**APP_ID**','**JS_ID**');
  }

  Future<void> _sendMail() async {
    backendless.messaging.sendTextEmail("Reminder","Email text body",["my_email@gmail.com"]).then((response) {
      print("Email has been sent");
    });
  }

在无后端电子邮件设置中,一切都设置正确。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。