[SOLVED] Front-end flutter website sending password reset emails with appwrite using SMTP (mailjet)
- 0
- Users
- Flutter
- Web
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; } }
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.
The "edventures-url" has the demo.edventures.ai domain or localhost?
Demo.Edventures.ai
Are you 100% sure it's that?
that looks like a literal string π not a variable or URL
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.
Tell us if changing it to you URL solves everything to mark this as solved π
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; } }
can you tey adding the protocol as well?
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.
yeah http should be okay
Thank you, i'll give it a try
let me know
Also does this url need to be in quotations?
yep
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".
Afaik, this is in works to allow devs. to customize the email templates. See: https://github.com/appwrite/appwrite/issues/3147 & RFC: https://github.com/appwrite/rfc/blob/b2b9e3a8ae23cd2511d36f883b26adb3152d8842/022-custom-smtp-and-email-templates.md
Ahh so it is currently not available?
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.
Thank you darShan!
no worries π
Yes! Coming in next version (1.4)
[SOLVED] Front-end flutter website sending password reset emails with appwrite using SMTP (mailjet)
Recommended threads
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...