For the complete site index, see llms.txt. Docs index: llms-docs.txt. Marketing corpus: llms-full.txt. Docs corpus: llms-full-docs.txt. Prefer markdown URLs where available (append .md).. Product skill: skill.md. Pricing: pricing.md. Docs MCP: /docs/mcp.

Tutorials/

Password Reset Email: Best Practices and Template

Pranav Patel

Pranav Patel

Co-founderยท11 min read

Password Reset Email: Best Practices and Template
Summary

How to build a secure password reset email: token design, expiry, rate limiting, link vs code, subject lines and copy, a full HTML and plain-text template, sending code and deliverability tips.

A good password reset email arrives in seconds, contains one link that works once and expires within an hour, and does not reveal whether an account exists. Everything else, from copy to design, comes after those three rules.

Password resets are the email users need most urgently and trust least. If one is slow, lands in spam or looks like phishing, the user gives up or opens a support ticket. If it is built carelessly, it becomes the easiest way to take over an account.

This guide covers the security side (tokens, expiry, rate limits), the email itself (subject, copy, a full template) and how to make sure it reaches the inbox.


The password reset flow

  1. User enters their email on a "Forgot password" form.
  2. Your server always shows the same message: "If an account exists, we sent a link."
  3. If the account exists, generate a token, store its hash, and email the link.
  4. User clicks the link and sets a new password.
  5. Server checks the token, updates the password, deletes the token and ends other sessions.
  6. Send a "Your password was changed" confirmation.

Steps 2, 5 and 6 are the ones most implementations skip.


Security best practices

1. Generate tokens with a secure random source

Use at least 32 random bytes from a cryptographically secure generator. Never use Math.random(), timestamps, user IDs or anything an attacker could guess.

typescript
1import { createHash, randomBytes } from "node:crypto";
2
3export function createResetToken(): { token: string; tokenHash: string } {
4 const token = randomBytes(32).toString("base64url"); // goes in the email
5 const tokenHash = createHash("sha256").update(token).digest("hex"); // goes in the DB
6 return { token, tokenHash };
7}

2. Store only the hash

Treat reset tokens like passwords. If your database leaks, plain-text tokens let an attacker reset any account with a pending request. A SHA-256 hash is enough here because the token is already high-entropy, so you do not need bcrypt.

sql
1CREATE TABLE password_reset_tokens (
2 id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
3 user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
4 token_hash text NOT NULL UNIQUE,
5 expires_at timestamptz NOT NULL,
6 used_at timestamptz
7);

3. Expire tokens quickly

15 to 60 minutes is the usual range. OWASP recommends short-lived tokens, and most users click within a few minutes. Show the expiry in the email so users know to act.

4. Make tokens single-use

Mark the token used (or delete it) in the same transaction that updates the password. Also delete every other outstanding reset token for that user, so older emails stop working.

5. Do not reveal whether an account exists

Return the same response, with the same status code and roughly the same timing, for known and unknown addresses. Otherwise your reset form tells attackers which emails have accounts.

To keep the timing the same, put the send on a background queue instead of awaiting it in the request.

6. Rate limit requests

Limit by email address (for example 3 requests per hour) and by IP (for example 20 per hour). This prevents mailbombing a victim and protects your sender reputation. Every reset email that goes unopened counts against you.

7. End other sessions after a reset

A reset often happens because someone else has the password. Revoke existing sessions and refresh tokens, and offer to keep only the current device signed in.

8. Never email the password itself

Do not send a new temporary password, and never send the old one. Email is not a secure channel, and it sits in inboxes for years.


Magic link
6-digit code
UX on same device
One click
Copy and paste
UX across devices (request on laptop, email on phone)
Opens on the wrong device
Works anywhere
Mobile apps
Needs universal links or deep links
Simple text field
Security
Long random token, hard to guess
Short, so needs strict attempt limits
Email scanners
Corporate link scanners can "click" it
Not affected

Use a link for web apps. Use a code for mobile apps or when users often switch devices. A code must expire faster (10 to 15 minutes) and lock after about 5 wrong attempts.

Microsoft Defender, Mimecast and other security gateways open links before the user does. If a GET request to your reset URL consumes the token, the user's click fails. Make the link open a page with the new password form, and consume the token only when that form is submitted (POST).


Writing the email

Subject lines

Keep them plain and recognisable. Users search their inbox for "reset" and "password".

  • Reset your Acme password
  • Your Acme password reset link
  • Reset your password (expires in 30 minutes)

Avoid urgency and alarm, like URGENT: Account security action required. That is what phishing looks like, and spam filters agree.

Copy that works

text
1Hi Ada,
2
3We received a request to reset the password for your Acme account
4(ada@example.com).
5
6[Reset password]
7
8This link expires in 30 minutes and can only be used once.
9
10If you did not ask for this, you can ignore this email. Your password
11will not change.
12
13Requested from Chrome on macOS, Berlin, Germany, at 14:32 UTC.

What makes it work:

  • Names the product and the account email. Users with several accounts know which one.
  • One clear button. No newsletter links, social icons or upsells.
  • States the expiry.
  • Tells users what to do if it was not them. Reassure them: ignoring the email is safe.
  • Shows request details (device, approximate location, time). This helps users spot attacks.
  • Includes the raw URL as a fallback for clients that break buttons.

Password reset email template

This template uses Reloop's {{{variable}}} placeholders, so you can paste it into a Reloop template and send it by ID. It uses tables and inline styles, so it renders in Outlook and Gmail. You can also preview and edit it in the email HTML editor.

html
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <title>Reset your password</title>
7 </head>
8 <body style="margin:0;padding:0;background:#f4f4f5;font-family:-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;">
9 <table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#f4f4f5;padding:32px 16px;">
10 <tr>
11 <td align="center">
12 <table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="max-width:480px;background:#ffffff;border-radius:8px;padding:32px;">
13 <tr>
14 <td style="font-size:20px;font-weight:600;color:#18181b;padding-bottom:16px;">
15 Reset your {{{product_name}}} password
16 </td>
17 </tr>
18 <tr>
19 <td style="font-size:15px;line-height:24px;color:#3f3f46;padding-bottom:24px;">
20 Hi {{{first_name}}}, we received a request to reset the password
21 for <strong>{{{email}}}</strong>. Click the button below to choose
22 a new one.
23 </td>
24 </tr>
25 <tr>
26 <td style="padding-bottom:24px;">
27 <a href="{{{reset_url}}}" style="display:inline-block;background:#18181b;color:#ffffff;text-decoration:none;font-size:15px;font-weight:600;padding:12px 24px;border-radius:6px;">
28 Reset password
29 </a>
30 </td>
31 </tr>
32 <tr>
33 <td style="font-size:14px;line-height:22px;color:#52525b;padding-bottom:16px;">
34 This link expires in {{{expires_in}}} and can only be used once.
35 If you did not ask for a reset, ignore this email. Your password
36 will not change.
37 </td>
38 </tr>
39 <tr>
40 <td style="font-size:13px;line-height:20px;color:#71717a;padding-bottom:16px;">
41 Requested from {{{request_device}}}, {{{request_location}}}.
42 </td>
43 </tr>
44 <tr>
45 <td style="font-size:12px;line-height:18px;color:#a1a1aa;word-break:break-all;">
46 Button not working? Paste this link into your browser:<br />
47 {{{reset_url}}}
48 </td>
49 </tr>
50 </table>
51 </td>
52 </tr>
53 </table>
54 </body>
55</html>

And the plain-text version:

text
1Reset your {{{product_name}}} password
2
3Hi {{{first_name}}}, we received a request to reset the password for {{{email}}}.
4
5Reset your password: {{{reset_url}}}
6
7This link expires in {{{expires_in}}} and can only be used once.
8If you did not ask for a reset, ignore this email. Your password will not change.
9
10Requested from {{{request_device}}}, {{{request_location}}}.

If you leave out the text part, Reloop generates one from the HTML so the message still goes out as multipart/alternative. Writing your own gives you control over the wording.


Sending the email

With the Reloop Node.js SDK (reloop-email 2.3 or later):

typescript
1import { Reloop } from "reloop-email";
2
3const reloop = new Reloop({ apiKey: process.env.RELOOP_API_KEY ?? "" });
4
5export async function sendPasswordReset(params: {
6 to: string;
7 firstName: string;
8 token: string;
9 device: string;
10 location: string;
11}): Promise<void> {
12 const resetUrl = `https://app.acme.com/reset-password?token=${params.token}`;
13
14 const { emailError } = await reloop.mail.send({
15 from: "Acme <security@auth.acme.com>",
16 to: params.to,
17 subject: "Reset your Acme password",
18 template: {
19 id: process.env.RELOOP_RESET_TEMPLATE_ID ?? "",
20 variables: {
21 product_name: "Acme",
22 first_name: escapeHtml(params.firstName),
23 email: params.to,
24 reset_url: resetUrl,
25 expires_in: "30 minutes",
26 request_device: escapeHtml(params.device),
27 request_location: escapeHtml(params.location),
28 },
29 },
30 tags: [{ name: "type", value: "password_reset" }],
31 });
32
33 if (emailError) {
34 // Log it, but do not tell the user. The response must look the same either way.
35 console.error("Password reset email failed", emailError.status, emailError.body.message);
36 }
37}
38
39function escapeHtml(value: string): string {
40 return value
41 .replace(/&/g, "&amp;")
42 .replace(/</g, "&lt;")
43 .replace(/>/g, "&gt;")
44 .replace(/"/g, "&quot;");
45}

The SDK returns { response, emailError } instead of throwing, so a failed send never crashes the request.

Retrying from a queue? Send the request with an Idempotency-Key header based on the token's database ID, for example password-reset-<token id>. A retry then returns the original result instead of sending a second email. A new reset request creates a new token, so it gets a new key and a new email.


Make sure it reaches the inbox

A reset email that lands in spam is the same as no email.

  1. Authenticate your domain. SPF, DKIM and an aligned DMARC record are required by Gmail, Yahoo and Outlook. See the setup guide and the bulk sender requirements.
  2. Use a dedicated transactional subdomain. Send security mail from something like auth.acme.com, separate from newsletters on news.acme.com. A bad campaign then cannot drag your reset emails into spam. See subdomain vs root domain.
  3. Turn off click tracking for security mail. Click tracking rewrites links through a redirect domain. That makes the link look less trustworthy, adds a hop, and puts the token in another system's logs. In Reloop, click and open tracking are set per domain on the domain's Configuration tab, so turn them off on your auth subdomain (domain settings).
  4. Do not use link shorteners. bit.ly, tinyurl.com and similar links are a classic phishing signal. Reloop rejects sends that contain them with Disallowed URL in email body. Link straight to your own domain.
  5. No unsubscribe header. Password resets are transactional and exempt from one-click unsubscribe rules. An unsubscribe link here only lets users block mail they need.
  6. Keep it short and image-free. One button, a fallback link and almost no images. Large images and many links look like marketing.
  7. Send in under 10 seconds. Users request a second reset after about 30 seconds, and then the first link no longer works. Use a fast queue and monitor delivery time.
  8. Suppress hard bounces. Reloop keeps a suppression list per organization so you do not keep sending to dead addresses.

Before you launch, send one through the deliverability tester to check authentication and spam signals.


The confirmation email

After the password changes, send a second email to the same address:

text
1Subject: Your Acme password was changed
2
3Hi Ada,
4
5The password for your Acme account (ada@example.com) was changed on
67 April 2026 at 14:35 UTC from Chrome on macOS, Berlin, Germany.
7
8If this was you, you don't need to do anything.
9
10If it wasn't you, secure your account now: https://app.acme.com/account-recovery

This is how users find out their account was taken over. Send it even when the change came from the settings page rather than a reset link. When the email address itself changes, send the notice to the old address too.


Password reset email not received? Checklist

  • Request reached your server (check logs, rate limiter and bot protection)
  • Account lookup used normalised email (lowercase, trimmed)
  • Send succeeded (check the email logs)
  • Address is not on the suppression list from a past bounce
  • Domain authenticated, test with the auth checker
  • Not in spam or the Promotions tab
  • Corporate gateway did not quarantine it (ask the user's IT team)
  • Token was not consumed by a link scanner (consume on POST, not GET)

FAQ

Between 15 and 60 minutes is the common range. Shorter is safer, but too short frustrates users who check email later. 30 minutes is a good default. Codes should expire faster, around 10 to 15 minutes.

Not on the website. The form should show the same message for every address. You can optionally email the address to say no account exists, because only the owner of that inbox sees it.

Usually a link scanner opened it first and your server consumed the token on a GET request. Show the password form on GET and only consume the token when the form is submitted. A second cause is users requesting the email twice, which invalidates the first link.

No. They are transactional messages that the user asked for. Gmail and Yahoo require one-click unsubscribe only for marketing and subscribed mail.

Yes. Store a SHA-256 hash and compare against it, the same way you would never store plain passwords. A leaked database should not give an attacker working reset links.

Yes. Both let you set custom SMTP credentials for auth emails. Point them at Reloop's SMTP relay so reset emails come from your own authenticated domain instead of a shared default sender.


W: 320.0px180R20โˆ 45.0ยฐ

Ship your first email with Reloop
in minutes.

Open-source, deliverability-focused, and yours to self-host or run on Reloop Cloud. No lock-in, no rewrite later.

Reloop