completionId: cgen-a8c8f2b9c11c48d0abbba6252f23a711

cgen-a8c8f2b9c11c48d0abbba6252f23a711
This commit is contained in:
Builder.io 2025-11-11 23:25:50 +00:00
parent f44f83007a
commit 5ab09a72b4

View file

@ -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: `
<h2>Ethos Guild Artist Verification</h2>
<p>Thank you for your interest in the Ethos Guild.</p>
<p>Unfortunately, your application was not approved at this time.</p>
${rejection_reason ? `<p><strong>Feedback:</strong> ${rejection_reason}</p>` : ""}
<p>You're welcome to reapply with updates to your portfolio or qualifications.</p>
<p><a href="https://aethex.dev/ethos">Learn more about the Ethos Guild</a></p>
`,
});
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: `
<div style="font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #0f172a;">
<h2 style="color: #db2777;">Ethos Guild Artist Verification</h2>
<p>Thank you for your interest in the Ethos Guild.</p>
<p>Unfortunately, your application was not approved at this time.</p>
${rejection_reason ? `<p style="margin: 16px 0; padding: 12px 16px; background: #fee2e2; border-left: 4px solid #ef4444; color: #7f1d1d;"><strong>Feedback:</strong> ${rejection_reason}</p>` : ""}
<p>You're welcome to reapply with updates to your portfolio or qualifications.</p>
<p style="margin: 24px 0;">
<a href="https://aethex.dev/ethos" style="background: linear-gradient(135deg, #db2777, #9333ea); color: #fff; padding: 12px 20px; border-radius: 999px; text-decoration: none; font-weight: 600; display: inline-block;">Learn more about Ethos Guild</a>
</p>
</div>
`,
});
} catch (emailError) {
console.error("Failed to send rejection email:", emailError);
}
}
return res.status(200).json({ data: request });