feat: email integration (nodemailer) + wire into agency/license flows
- src/lib/email.ts: SMTP client with pre-built templates: - sendAgencyApprovedEmail (reseller approval + discount) - sendAgencyRejectedEmail (reseller rejection + reason) - sendLicenseKeyEmail (license key delivery) - sendTicketCreatedEmail (ticket confirmation) - Agency approve route: sends approval email after DB update - Agency reject route: sends rejection email with reason - License creation route: sends license key email (fire-and-forget) - Graceful degradation: if SMTP not configured, logs warning + continues - nodemailer + @types/nodemailer installed
This commit is contained in:
1 parent
7a13dad693
commit
970986fef7
6 files changed
+158
-4
No files matched your search
@@ -60,6 +60,16 @@ export async function PATCH(req: Request, { params }: { params: Promise<{ id: st
|
||||
},
|
||||
})
|
||||
|
||||
// Send rejection email
|
||||
const { sendAgencyRejectedEmail } = await import('@/lib/email')
|
||||
if (application.company.email) {
|
||||
await sendAgencyRejectedEmail({
|
||||
to: application.company.email,
|
||||
companyName: application.company.name,
|
||||
reason,
|
||||
})
|
||||
}
|
||||
|
||||
return NextResponse.json({ ok: true, status: 'rejected', reason })
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : 'internal server error'
|
||||
|
||||
Reference in new issue
Block a user