diff --git a/api/ethos/verification.ts b/api/ethos/verification.ts index 01f4db80..15bdaebd 100644 --- a/api/ethos/verification.ts +++ b/api/ethos/verification.ts @@ -267,19 +267,40 @@ export default async function handler(req: any, res: any) { .eq("id", request.user_id) .single(); - if (userData?.email) { - await sendEmail({ - to: userData.email, - subject: "Ethos Guild Artist Verification - Application Decision", - html: ` -

Ethos Guild Artist Verification

-

Thank you for your interest in the Ethos Guild.

-

Unfortunately, your application was not approved at this time.

- ${rejection_reason ? `

Feedback: ${rejection_reason}

` : ""} -

You're welcome to reapply with updates to your portfolio or qualifications.

-

Learn more about the Ethos Guild

- `, - }); + if (userData?.email && emailService.isConfigured) { + try { + // Send rejection 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: "Ethos Guild Artist Verification - Application Decision", + html: ` +
+

Ethos Guild Artist Verification

+

Thank you for your interest in the Ethos Guild.

+

Unfortunately, your application was not approved at this time.

+ ${rejection_reason ? `

Feedback: ${rejection_reason}

` : ""} +

You're welcome to reapply with updates to your portfolio or qualifications.

+

+ Learn more about Ethos Guild +

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