mirror of
https://github.com/harivansh-afk/Saas-Teamspace.git
synced 2026-04-19 16:03:42 +00:00
initial commit
This commit is contained in:
commit
ef9ccf22d3
133 changed files with 20802 additions and 0 deletions
35
lib/mail.ts
Normal file
35
lib/mail.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import ResetPassword from '@/emails/reset-email'
|
||||
import LinkEmail from '@/emails/verify-email'
|
||||
import { render } from '@react-email/components'
|
||||
import { Link } from 'lucide-react'
|
||||
import { Resend } from 'resend'
|
||||
|
||||
const resend = new Resend(process.env.RESEND_API_KEY)
|
||||
|
||||
// Send a verification email to the user
|
||||
export const sendVerificationEmail = async (email: string, token: string) => {
|
||||
const confirmLink = `http://localhost:3000/new-verification?token=${token}`
|
||||
|
||||
await resend.emails.send({
|
||||
from: 'Nizar <noreply@resend.dev>',
|
||||
to: email,
|
||||
subject: 'Confirm your email',
|
||||
html: render(LinkEmail({ token }))
|
||||
})
|
||||
|
||||
resend.contacts.create({
|
||||
email: email,
|
||||
audienceId: process.env.RESEND_AUDIENCE as string
|
||||
})
|
||||
}
|
||||
// Send password reset token to user
|
||||
export const sendPasswordResetEmail = async (email: string, token: string) => {
|
||||
const resetLink = `${process.env.APP_URL}/new-password?token=${token}`
|
||||
|
||||
await resend.emails.send({
|
||||
from: 'Nizar <noreply@resend.dev>',
|
||||
to: email,
|
||||
subject: 'Reset your password',
|
||||
html: render(ResetPassword({ token }))
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue