mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
BREAKING: postgres + saas
This commit is contained in:
28
lib/email.ts
Normal file
28
lib/email.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { NewsletterWelcomeEmail } from "@/components/emails/newsletter-welcome-email"
|
||||
import { OTPEmail } from "@/components/emails/otp-email"
|
||||
import React from "react"
|
||||
import { Resend } from "resend"
|
||||
|
||||
export const resend = new Resend(process.env.RESEND_API_KEY)
|
||||
|
||||
export async function sendOTPCodeEmail({ email, otp }: { email: string; otp: string }) {
|
||||
const html = React.createElement(OTPEmail, { otp })
|
||||
|
||||
return await resend.emails.send({
|
||||
from: process.env.RESEND_FROM_EMAIL!,
|
||||
to: email,
|
||||
subject: "Your TaxHacker verification code",
|
||||
react: html,
|
||||
})
|
||||
}
|
||||
|
||||
export async function sendNewsletterWelcomeEmail(email: string) {
|
||||
const html = React.createElement(NewsletterWelcomeEmail)
|
||||
|
||||
return await resend.emails.send({
|
||||
from: process.env.RESEND_FROM_EMAIL as string,
|
||||
to: email,
|
||||
subject: "Welcome to TaxHacker Newsletter!",
|
||||
react: html,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user