r/Supabase • u/mdausmann • 7d ago
auth Prevent gmail message threading for reset emails
A user raised an issue around password reset. They did a reset, got distracted (so the link expired) then did another reset... but they couldn't find the second link in their gmail.
Fair enough, it's right there under the ellipsis ('...') but it's confusing, you need to look at the times to see what is the latest, then click the '...' to expand the second email and click the link... it's all work.
Can I prevent the threading? I think If I put something like the reset token (which changes per attempt) in the subject of the email, it might prevent threading. But I don't think I can customise the subject like that? Can I put variables in the subject?
7
u/sadsloth97 7d ago
I believe if you change the subject line they don’t thread
1
u/mdausmann 7d ago
ok turns out just customising the email body text is enough to stop the threading (or at least gmail shows the last email expanded in the thread). So this works but it's uggggggggly. any ideas?? A Timestamp or something?
3
u/Purple-Sundae-5392 7d ago
Yes, the subject takes the same template variables as the body. Supabase's own default subject for the reauthentication email is literally
{{ .Token }} is your verification code, so you can do the same thing for recovery.In the dashboard open Authentication > Emails, pick the Reset password template and set the subject to something like:
Reset your password (code {{ .Token }})The token is new on every request, so Gmail sees a different subject and starts a fresh thread instead of stacking them under the ellipsis. If you keep config in code, it's
subjectunder[auth.email.template.recovery]in config.toml, ormailer_subjects_recoverythrough the Management API.One tradeoff: the code then shows up in lock screen notification previews. If you'd rather avoid that, the Send Email hook lets you send through your own provider and build the subject yourself, and something like "requested at 14:32" breaks the threading just as well.
1
u/Mysterious-Edge-5553 7d ago
SendGrid and Postmark both let you template the subject, so yeah you can do it. But 'Reset your password a3f9c2' in a subject line is going to read as phishing to a chunk of your users, and it only papers over the real thing: why is the first link dead in the first place. Auth0 got dragged for exactly this, letting both links work until the TTL expires costs you nothing.
1
u/Famous_Subject9544 7d ago
You can put variables in the subject, Postmark and SendGrid both support it, so that part is doable. But "Reset your password 8f3a9c1" sitting in a subject line reads like phishing and someone will hit report. The thing worth fixing is that requesting a second link kills the first one, Auth0 does the same and that is what pushes people into the... menu at all.
1
u/No-Front1428 7d ago
Changing the subject won't do anything, Gmail threads on the References header, not the subject line. Just letting the first link stay valid until it actually expires would have saved the guy the trouble.
1
u/Neat_Act_9199 7d ago
You're guessing though. Has anyone actually confirmed Gmail re-threads when the subject changes? That assumption is the entire fix, worth testing it on a real account before touching the email flow.
1
u/Smooth_Gur_8847 7d ago
Gmail isn't the problem. If the first link stayed valid until its TTL, nobody would have to open the ellipsis hunting for the newest email.
1
u/MutedMetal9358 7d ago
you need to look at the times to see what is the latest" → "which is the latest". The rest I'll leave alone.
1
u/Winter_Project9674 7d ago
Fair, that ellipsis hunt is annyoing. Most providers do let you drop a variable into the subject line, and a unique subject is usually enough on its own since Gmail groups by sender plus subject. Worth checking whether your emails also reuse the same In-Reply-To/References headers, that alone can keep them threaded.
1
u/KaleidoscopeSafe8849 7d ago
Every ESP I've touched lets you put variables in the subject line, that part isn't the blocker. And Gmail leaves the newest message in the thread expanded, not the oldest, so the times thing is backwards.
1
u/TraditionalTap6697 6d ago
Un utilisateur distrait, ça fait pas une tendance. Le lien expirait au bout de combien de temps? Si c'est 15 minutes, le problème c'est le TTL, pas le fil de Gmail.
1
u/Status_Ad8999 4d ago
if you ever move to the Send Email hook with Resend or Postmark, setting a unique X-Entity-Ref-ID header per send breaks Gmail threading cleanly without changing the subject or putting weird tokens in the body.