Prompt
How do I send password reset emails from my app without running my own mail server?
Latest observation
Nov 25, 2026
OpenAI APIWeb search: off
You don’t need to run your own mail server. The common approach is:
Use an email delivery service
These services send email on your behalf via SMTP or an API:
- SendGrid
- Mailgun
- Amazon SES
- Postmark
- Resend
- SparkPost
They handle deliverability, retries, bounce tracking, reputation, etc.
Typical setup
- Create an account with an email provider.
- Verify your sending domain
Add DNS records they give you:- SPF
- DKIM
- often DMARC too
- Use their SMTP or API from your app to send reset emails.
- Generate a secure reset token in your app and store a hashed version in your DB with an expiration time.
- Email the user a reset link like:
https://yourapp.com/reset-password?token=... - When the user clicks the link, verify the token, expire it after one use, and let them set a new password.
Important security practices
- Use random, long, single-use tokens
- Expire tokens quickly (e.g. 15–60 minutes)
- Store hashed tokens, not plaintext
- Don’t reveal whether an email exists in your system
- Rate-limit reset requests
- Use HTTPS only
- Invalidate existing sessions after password change
Example flow
- User submits email on “Forgot password”
- Your backend always responds with something like: “If an account exists, we sent a reset email.”
- If the account exists:
- create token
- save hashed token + expiry
- send email through provider
- User clicks link
- Your backend verifies token and allows password update
Simple implementation options
- SMTP: easiest to plug into many apps
- HTTP API: often better reliability and easier tracking
If you want, I can show you:
- a Node.js / Express example
- a Python / Django or Flask example
- or a language-agnostic reset token design