Search code examples
flutteremailsmtp

how can send email for reseting password


I want to set a Screen in my app for sending an email for resetting password. I can send an Email from firebase but I do not know how I can write codes when user click on 'reset password button' automatically a confirming email send for user. Also I read some text about smtp but I could not understand what I should do , please guide me


Solution

  • you can send reset password email using this code

     sendEmail() async {
        try {
          showLoader(context);
          String emailAddress = "[email protected]";  // email address
          await FirebaseAuth.instance.sendPasswordResetEmail(email: emailAddress);
          
        } catch (e) {
          print("Error: $e");
         
        }
      }