feat: user activation and emails
This commit is contained in:
24
utils/sender.ts
Normal file
24
utils/sender.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Resend } from 'resend';
|
||||
|
||||
export async function sendEmail(
|
||||
to: string[],
|
||||
subject: string,
|
||||
template: JSX.Element
|
||||
) {
|
||||
const resend = new Resend(process.env.RESEND_KEY);
|
||||
|
||||
try {
|
||||
const { error } = await resend.emails.send({
|
||||
from: process.env.RESEND_FROM!,
|
||||
to,
|
||||
subject,
|
||||
react: template,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.log(error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user