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 (将#修改为@)