-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail.ts
26 lines (21 loc) · 828 Bytes
/
mail.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { Resend } from "resend";
const resend = new Resend(process.env.RESEND_API_KEY);
const domain = process.env.NEXT_PUBLIC_APP_URL;
export const sendVerificationEmail = async (email: string, token: string) => {
const confirmLink = `${domain}/auth/new-verification?token=${token}`;
await resend.emails.send({
from: "[email protected]",
to: email,
subject: "Confirm your email",
html: `<p>click<a href="${confirmLink}">here</a>to verify</p>`,
});
};
export const sendPasswordResetEmail = async (email: string, token: string) => {
const resetLink = `${domain}/auth/new-password?token=${token}`;
await resend.emails.send({
from: "[email protected]",
to: email,
subject: "Reset the password",
html: `<p>click<a href="${resetLink}">here</a> to reset password</p>`,
});
};