Add board-specific welcome email template and logic
All checks were successful
Build And Push Image / docker (push) Successful in 1m43s

- Create separate welcome email template for board members
- Add conditional logic to use board template based on membership tier
- Update email service to support sendWelcomeBoardEmail method
- Include board-specific subject line and template preloading
This commit is contained in:
2025-08-14 09:25:56 +02:00
parent 1ab45cf503
commit 400f9cdd52
3 changed files with 357 additions and 4 deletions

View File

@@ -135,7 +135,7 @@ export default defineEventHandler(async (event) => {
const config = useRuntimeConfig();
const verificationLink = `https://portal.monacousa.org/auth/verify?token=${verificationToken}`;
await emailService.sendWelcomeEmail(member.email, {
const emailData = {
firstName: member.first_name,
lastName: member.last_name,
verificationLink,
@@ -145,10 +145,19 @@ export default defineEventHandler(async (event) => {
month: 'long',
day: 'numeric'
})
});
};
// Use appropriate email template based on membership tier
if (membershipTier === 'board') {
console.log('[api/members/[id]/create-portal-account.post] Sending board-specific welcome email');
await emailService.sendWelcomeBoardEmail(member.email, emailData);
} else {
console.log('[api/members/[id]/create-portal-account.post] Sending standard welcome email');
await emailService.sendWelcomeEmail(member.email, emailData);
}
emailSent = true;
console.log('[api/members/[id]/create-portal-account.post] Welcome email sent successfully');
console.log(`[api/members/[id]/create-portal-account.post] Welcome email sent successfully (${membershipTier} template)`);
} catch (error: any) {
emailError = error.message || 'Unknown email error';
console.error('[api/members/[id]/create-portal-account.post] Failed to send welcome email:', emailError);