"Unknown error validating email code" when changing password

After setting up the SMTP settings to send emails via gmail, I am able to receive an email when I fill in the forgot password field. But after I fill in the new password and press submit I get an error: Unknown error validating email code.

What can cause this error?
Thanks in advance!