| 1 | import { Resend } from "resend"; |
| 2 | |
| 3 | const RESEND_API_KEY = process.env.RESEND_API_KEY; |
| 4 | |
| 5 | export const resend = new Resend(RESEND_API_KEY); |
| 6 | |
| 7 | export const sendPremiumConfirmationEmail = async ( |
| 8 | userEmail: string, |
| 9 | userName: string |
| 10 | ) => { |
| 11 | try { |
| 12 | await resend.emails.send({ |
| 13 | from: "Acme <onboarding@resend.dev>", |
| 14 | to: userEmail, |
| 15 | subject: "Welcome to Premium", |
| 16 | html: `<p>Hi ${userName},</p><p>Welcome to Premium. You're now a Premium user!</p>`, |
| 17 | }); |
| 18 | } catch (error) { |
| 19 | console.error(error); |
| 20 | } |
| 21 | }; |