From f44f83007a3c7349b98ad8949c9237817c6b429f Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 11 Nov 2025 23:25:44 +0000 Subject: [PATCH] completionId: cgen-a807ec6080f94cb6881fc4c1ffe09a72 cgen-a807ec6080f94cb6881fc4c1ffe09a72 --- api/ethos/verification.ts | 55 +++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/api/ethos/verification.ts b/api/ethos/verification.ts index fcded995..01f4db80 100644 --- a/api/ethos/verification.ts +++ b/api/ethos/verification.ts @@ -181,23 +181,44 @@ export default async function handler(req: any, res: any) { .eq("id", request.user_id) .single(); - if (userData?.email) { - await sendEmail({ - to: userData.email, - subject: "Your Ethos Guild Artist Verification - Approved! 🎵", - html: ` -

Welcome to the Ethos Guild, ${userData.full_name}!

-

Congratulations! Your artist verification has been approved.

-

You can now:

- -

Go to your artist settings to start uploading.

- `, - }); + if (userData?.email && emailService.isConfigured) { + try { + // Send verification approval email using nodemailer + const nodemailer = require("nodemailer"); + const transporter = nodemailer.createTransport({ + host: process.env.SMTP_HOST, + port: parseInt(process.env.SMTP_PORT || "465"), + secure: parseInt(process.env.SMTP_PORT || "465") === 465, + auth: { + user: process.env.SMTP_USER, + pass: process.env.SMTP_PASSWORD, + }, + }); + + await transporter.sendMail({ + from: process.env.SMTP_FROM_EMAIL || "no-reply@aethex.tech", + to: userData.email, + subject: "Your Ethos Guild Artist Verification - Approved! 🎵", + html: ` +
+

Welcome to the Ethos Guild, ${userData.full_name}!

+

Congratulations! Your artist verification has been approved.

+

You can now:

+ +

+ Go to artist settings +

+
+ `, + }); + } catch (emailError) { + console.error("Failed to send verification email:", emailError); + } } return res.status(200).json({ data: request });