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

30 messages · Page 1 of 1 (latest)

golden obsidian
#

I am having difficulties sending out password resets. I have configured my Appwrite .env file to use the correct SMTP settings. I am using Mailjet for SMTP and on Mailjet i have configured the domain "edventures.ai" which is active. For addresses I am sending this email from "Team edventures" using the email "[email protected]". This is also active and verified. My flutter front-end website is sending these password reset requests from "demo.edventures.ai" which is just a subdomain of "edventures.ai". Why do I get these errors?

[Log] Failed to send password reset email: AppwriteException: general_argument_invalid, Invalid url: URL host must be one of: localhost, 178.128.196.153, 64.226.108.199, demo.edventures.ai (400) (main.dart.js, line 26761)

#

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

torn zodiac
golden obsidian
#

In my front end console after sending a request

torn zodiac
#

Could you please send the code here used to send the email?

#

Just such part, not needed the entire code

golden obsidian
#

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;
}
}

jolly gust
torn zodiac
golden obsidian
torn zodiac
#

Are you 100% sure it's that?

jolly gust
golden obsidian
#

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.

torn zodiac
golden obsidian
#

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;
}
}

golden obsidian
#

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.

golden obsidian
#

Thank you, i'll give it a try

naive sundial
golden obsidian
#

Also does this url need to be in quotations?

naive sundial
#

yep

golden obsidian
#

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".

weak lark
golden obsidian
#

Ahh so it is currently not available?

weak lark
#

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.

golden obsidian
#

Thank you darShan!

weak lark
#

no worries 🙂

torn zodiac