mirror of
https://github.com/vas3k/TaxHacker.git
synced 2025-12-21 13:00:24 -06:00
30 lines
864 B
TypeScript
30 lines
864 B
TypeScript
import { NewsletterWelcomeEmail } from "@/components/emails/newsletter-welcome-email"
|
|
import { OTPEmail } from "@/components/emails/otp-email"
|
|
import React from "react"
|
|
import { Resend } from "resend"
|
|
import config from "./config"
|
|
|
|
export const resend = new Resend(config.email.apiKey)
|
|
|
|
export async function sendOTPCodeEmail({ email, otp }: { email: string; otp: string }) {
|
|
const html = React.createElement(OTPEmail, { otp })
|
|
|
|
return await resend.emails.send({
|
|
from: config.email.from,
|
|
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: config.email.from,
|
|
to: email,
|
|
subject: "Welcome to TaxHacker Newsletter!",
|
|
react: html,
|
|
})
|
|
}
|