This project demonstrates how to create a noreply email service specifically for resetting passwords using Resend and Vercel. This guide will walk you through the steps to set up and deploy the service.
- Visit Resend.com
- Sign up and log in to your account
2. Verify Domain (for [email protected])
- Navigate to the Domains section
- Add
nicztin.com
- Resend will provide DNS Records (SPF, DKIM, DMARC)
- Go to your DNS provider (e.g., Cloudflare, Namecheap, Vercel DNS...)
- Add the provided DNS Records and wait for verification
Create an API route (pages/api/reset-password.js
) in your Vercel project:
import { Resend } from "resend";
const resend = new Resend(process.env.RESEND_API_KEY);
export default async function handler(req, res) {
if (req.method !== "POST") return res.status(405).send("Method Not Allowed");
const { email, resetLink } = req.body;
try {
await resend.emails.send({
from: "[email protected]",
to: email,
subject: "Reset Your Password",
html: `<p>Click <a href="${resetLink}">here</a> to reset your password.</p>`,
});
res.status(200).json({ success: true });
} catch (error) {
res.status(500).json({ error: error.message });
}
}
- Navigate to Vercel > Project > Settings > Environment Variables
- Add
RESEND_API_KEY = YOUR_RESEND_API_KEY
Send a POST request to /api/reset-password
with the following JSON data:
{
"email": "[email protected]",
"resetLink": "https://nicztin.com/reset-password?token=XYZ"
}
Now you can send noreply emails for resetting passwords automatically!
Would you like to add features such as OTP or a UI for changing passwords? Feel free to contribute!
This project is licensed under the MIT License.