Fix guide · updated 2026-11-16
Supabase "Error sending recovery email"
AuthRetryableFetchError: Error sending recovery email · Error sending magic link email · 500
The password reset or the magic link button fails with Error sending recovery email or Error sending magic link email. Supabase tried to hand the email to your email provider and the provider said no, or never answered. The message doesn't say why, but Supabase's Auth log does. We ran Supabase's real Auth server against a test mail server that fails in each common way, with supabase-js 2.119, and wrote down what each failure looks like. Three surprises: a reset for an address with no account always "works", every failed attempt still counts against your hourly email limit, and a slow mail server can deliver an email whose link is already dead.
What the error means
Supabase Auth builds the email, connects to the SMTP server in your settings (Resend, Postmark, Brevo, Amazon SES…) and sends it. If any step fails, it answers with a 500 that only says which email failed:
500 {"code":"unexpected_failure","message":"Error sending recovery email"}
From curl, Postman or another language, without the version header supabase-js sends:
500 {"code":500,"error_code":"unexpected_failure","msg":"Error sending recovery email","error_id":"…"}
In supabase-js 2.119 it arrives as AuthRetryableFetchError with status 500, and error.code is undefined. The same failure gets a different name depending on the email Auth was sending. In our test, with the mail server refusing the password:
resetPasswordForEmail():Error sending recovery email, also for an account that isn't confirmed yet.signInWithOtp()for a confirmed user:Error sending magic link email. For a new user, or one who never confirmed, Auth sends a sign-up confirmation instead, so the message isError sending confirmation email.signUp()andresend({ type: 'signup' }):Error sending confirmation email.updateUser({ email }):Error sending email change email.reauthenticate():Error sending reauthentication email.auth.admin.inviteUserByEmail():Error sending invite email.
All of them have the same causes and the same fix. If you never set up your own email provider, read our guide to "Error sending confirmation email" first: Supabase's built-in email only sends to your team and refuses everyone else with "Email address not authorized".
1. Read the real reason in the Auth log
Supabase dashboard → Logs. Set Log Type to Auth and Level to error, then open the line for your request: path /recover for a password reset, /otp for a magic link. Under Raw JSON, the error field holds what the mail server answered. One of ours:
{"msg": "request completed", "path": "/recover", "status": 500,
"error_code": "unexpected_failure",
"error": "535 \"5.7.8 Authentication credentials invalid\"", …}
Find the start of your error field here. The number is a standard SMTP code. The words after it are your provider's own, so they're more precise than ours:
535 …: the SMTP username or password is wrong. Copy both again from your provider. For Resend, the username isresendand the password is an API key. If you deleted or replaced that key, put the new one in.gomail: could not send email 1: 550 …(or another code starting with 5, like 554): the login worked, but the provider refused this email. Its words say why. The usual one: the Sender email in Supabase isn't on the domain you verified with the provider. Also common: an account still in test mode, like Resend's "You can only send testing emails to your own email address".gomail: could not send email 1: 451 …(any code starting with 4): a temporary refusal, often a sending limit at the provider. Check your provider's dashboard for limits, then try again.unencrypted connection: the server didn't offer encryption on that port, so Auth refused to send your password over it. Check the host and port against your provider's SMTP page.tls: first record does not look like a TLS handshake: port 465 on a server that doesn't use TLS on that port. Use 587.tls: failed to verify certificate: x509: certificate is valid for …, not …: the host name doesn't match the server's certificate. Use the exact host from your provider, not an IP address or a name of your own pointing to it.dial tcp …: connect: connection refused,EOF, or a421: nothing answered at that host and port, or the server hung up at once. Check the host and port.context deadline exceeded, with status 504: the server didn't answer within Auth's 10-second limit. Your app got a different message for this one, see section 3.
Change the settings under Authentication → SMTP Settings, save, and try again. There's no need to wait: a failed attempt doesn't start the 60-second wait between two emails to the same person.
2. Port 465 is the only TLS port Supabase knows
Auth's mail code turns on TLS from the first byte only when the port is exactly 465. On any other port it starts unencrypted and switches to encryption with STARTTLS. So:
- 465: TLS from the start. Worked in our test.
- 587 (and the other ports, like 2587): starts plain, then STARTTLS. 587 worked in our test.
- 2465: Resend lists it as TLS from the start, like 465. Supabase doesn't know that, so it waits for a hello the server never sends. After 10 seconds your app gets
Processing this request timed out, please retry after a moment.(status 504). Use 465 or 587 instead.
3. "Processing this request timed out": the email may still arrive, with a dead link
When the mail server is slow or silent, Auth gives up after 10 seconds and answers:
504 {"code":"request_timeout","message":"Processing this request timed out, please retry after a moment."}
It doesn't stop the sending, though. Our test server waited 12 seconds before saying hello. The app got the 504 at 10 seconds, and the reset email still arrived two seconds later. Its link didn't work: Email link is invalid or has expired, because Auth had already given up and saved nothing for that link. So users who saw the error and then got the email anyway hit the expired-link error. Once your mail settings are fixed, they need to ask for a new email.
A wrong port (section 2), or a mail server that accepts the connection but doesn't answer, ends the same way.
4. Why it "works" when you test it
- A made-up address.
resetPasswordForEmail()for an address with no account answersokand sends nothing, so it never touches your mail server. Auth answers the same either way, so the form doesn't reveal who has an account. Test the reset with a real account. - Confirm email turned off. Then
signUp()sends no email and works fine, while password resets and magic links still need your mail server and fail. In our test,signInWithOtp()for a new address created a confirmed user and then failed withError sending magic link email. With Confirm email on, the same call left no user behind.
5. Failed attempts still use up your hourly email limit
With Confirm email on (the default), Supabase counts an email against the project's hourly limit before it tries to send it (30 an hour by default once you use your own SMTP). A failed send counts too. We set the limit to 3: two failed resets and one that worked used it up, and the next request got email rate limit exceeded without even trying the mail server. So after an afternoon of failures, users can stay blocked for the rest of the hour even though your settings are fixed. Raise the limit in Authentication → Rate Limits, or see our guide to "email rate limit exceeded".
6. Help a locked-out user right now
On your server, with the secret service-role key, auth.admin.generateLink() returns the link without sending any email. It worked in our test while the mail server was refusing everything:
const { data, error } = await supabaseAdmin.auth.admin.generateLink({
type: 'recovery', // or 'magiclink'
email: 'user@theirdomain.com',
})
// data.properties.action_link = the link the email would have contained
That link signs the person in, so only give it to someone you've confirmed owns the account. It's a stopgap while you fix the settings, not a way around them.
Show a message people understand
Check error.status, not error.code (it's empty for these errors in supabase-js 2.119):
const { error } = await supabase.auth.resetPasswordForEmail(email, { redirectTo })
if (error && (error.status === 500 || error.status === 504)) {
setError("We couldn't send the email right now. Please try again in a few minutes.")
} else if (error) {
setError(error.message)
} else {
setNotice('If an account exists for this address, we sent a link.')
}
If an AI tool built your app
This error comes from the email settings in your Supabase dashboard, so no code change fixes it, and an AI tool that rewrites your login flow will make things worse. Fix the settings first (sections 1 and 2), then give your tool this prompt for the message:
When supabase.auth.resetPasswordForEmail or signInWithOtp returns an error with status 500 or 504 ("Error sending recovery email", "Error sending magic link email" or "Processing this request timed out"), show "We couldn't send the email right now. Please try again in a few minutes." instead of the raw message. Don't treat it as a network error and don't retry automatically. Don't change the sign-in flow or anything else.
Using a Send Email hook instead of SMTP?
Then you won't see these messages. Auth passes on what your hook said. In our test: a hook that answered 500 gave Unexpected status code returned from hook: 500, a hook that never answered gave Failed to reach hook after maximum retries (422, after 3 tries), and a hook that answered { "error": { "http_code": 400, "message": "…" } } passed its own message to the app. The reason is in your hook's logs, for example your Edge Function's logs.
Not quite your error?
- "Error sending confirmation email" or "Email address "x" cannot be used as it is not authorized": Supabase's built-in email only sends to your team.
- "email rate limit exceeded" or "For security purposes, you can only request this after N seconds": too many emails.
- "Email address "x" is invalid": Supabase refused the address itself.
- "Email link is invalid or has expired": the link was used, replaced or too old.
Still stuck?
Put the same host, port, username and password into another email program, or your provider's own test tool. If it fails there too, the problem is at the provider: contact their support with the time of the failed request, and they can read the refusal in their own logs. If it works there and Supabase still fails, compare the Sender email and the port, the two settings other programs fill in for you.
Other Supabase problems? See Supabase fixes.