Flutter Web - Backendless - How to Send Mail

139 Views Asked by At

I am developing a website with flutter web. on this web site there is a page to directly send an email from the site.

To do this I thought about using Backendless: https://backendless.com/docs/flutter/email_settings.html

But when I send a simple email it gives me the following problem.

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

Below is the code for sending the email

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

  Future<void> _sendMail() async {
    Backendless.messaging.sendTextEmail("Reminder", "Email text body",
        ["[email protected]"]).then((response) {
      print("Email has been sent");
    });
  }

in the backendless e-mail setting everything is set correctly.

0

There are 0 best solutions below