Back

[SOLVED] Front-end flutter website sending password reset emails with appwrite using SMTP (mailjet)

  • 0
  • Users
  • Flutter
  • Web
tahakhawaja
16 Aug, 2023, 17:55

Future sendPasswordReset(String email) async { try { await Account(client).createRecovery( email: email, url: 'edventures-url', // Use the full URL ); print('Password reset email sent successfully'); } catch (e) { print('Failed to send password reset email: $e'); throw e; } }

// password reset function Future passwordReset(String userId, String secret, String password, String confirmPassword) async { try { await account.updateRecovery( userId: 'userId', secret: 'secret', password: password, passwordAgain: confirmPassword ); print('Password reset successful'); } catch (e) { print('Failed to reset password: $e'); throw e; } }

TL;DR
The user was having trouble customizing the password reset email template on their front-end Flutter website that uses Appwrite and SMTP (Mailjet). Another user provided a solution by changing the template at the source files level, but mentioned that it may need to be edited with every Appwrite update. There was also a discussion about changing the email template to say "Team Edventures" instead of "Flutter Webapp (Alpha) Team" and changing other mentions of "Flutter Webapp (Alpha) password" to "Edventures password" along with adjusting the URL format. The user confirmed that the solution worked for them.
Drake
16 Aug, 2023, 18:07

FYI, it's best to wrap code in backticks to format a bit nicer. You can use 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.

D5
16 Aug, 2023, 19:34

The "edventures-url" has the demo.edventures.ai domain or localhost?

tahakhawaja
16 Aug, 2023, 19:34

Demo.Edventures.ai

D5
16 Aug, 2023, 19:35

Are you 100% sure it's that?

Drake
16 Aug, 2023, 19:35

that looks like a literal string πŸ‘€ not a variable or URL

tahakhawaja
16 Aug, 2023, 19:36

Ahh I see that makes sense, thank you for catching that! Might have been the issue. Thank you for the help! I’ll reach out if it doesn’t work.

D5
16 Aug, 2023, 19:37

Tell us if changing it to you URL solves everything to mark this as solved πŸ˜„

tahakhawaja
17 Aug, 2023, 06:46

So i've gone ahead and changed the url so that it looks like this now but I still get the same error:

Future sendPasswordReset(String email) async { try { await Account(client).createRecovery( email: email, url: 'demo.edventures.ai', // Use the full URL ); print('Password reset email sent successfully'); } catch (e) { print('Failed to send password reset email: $e'); throw e; } }

safwan
17 Aug, 2023, 06:53

can you tey adding the protocol as well?

safwan
17 Aug, 2023, 06:53
tahakhawaja
17 Aug, 2023, 06:54

Does it need to be https or can I use http? Cause we currently do not have SSL set up on the droplet at the moment.

safwan
17 Aug, 2023, 06:54

yeah http should be okay

tahakhawaja
17 Aug, 2023, 06:54

Thank you, i'll give it a try

safwan
17 Aug, 2023, 06:54

let me know

tahakhawaja
17 Aug, 2023, 06:54

Also does this url need to be in quotations?

safwan
17 Aug, 2023, 06:55

yep

tahakhawaja
17 Aug, 2023, 07:25

It worked! Thank you!!

I have another question for you if possible? I'd like some guidance on how I can fix this situation here:

The reset email currently looks like this:

Flutter Webapp (Alpha) Team

Hello Taha Follow this link to reset your Flutter Webapp (Alpha) password. (URL LINK) If you didn’t ask to reset your password, you can ignore this message. Thanks Flutter Webapp (Alpha) team

How can I change the first line, that says Flutter Webapp (Alpha) Team to "Team Edventures"? I'd also like to change the second mention of "Flutter Webapp (Alpha) password" to "Edventures password", and the last mention of it in "Thanks Flutter Webapp (Alpha) team" to "Team Edventures".

darShan
17 Aug, 2023, 07:28
tahakhawaja
17 Aug, 2023, 07:30

Ahh so it is currently not available?

darShan
17 Aug, 2023, 07:37

You could basically change the template, but that would be at the source files levels. But this may require you to edit the source templates on every appwrite update as they would be overriden, i guess.

tahakhawaja
17 Aug, 2023, 07:39

Thank you darShan!

darShan
17 Aug, 2023, 07:46

no worries πŸ™‚

D5
17 Aug, 2023, 08:22

Yes! Coming in next version (1.4)

D5
17 Aug, 2023, 08:23

[SOLVED] Front-end flutter website sending password reset emails with appwrite using SMTP (mailjet)

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more