fixes
Build And Push Image / docker (push) Successful in 1m31s Details

This commit is contained in:
Matt 2025-08-15 14:52:18 +02:00
parent a8022d8fb3
commit df6d549573
2 changed files with 44 additions and 2 deletions

View File

@ -46,8 +46,8 @@ export default defineEventHandler(async (event) => {
const memberName = member.FullName || `${member.first_name} ${member.last_name}`.trim() || 'Member';
const nextDueDate = getNextDuesDate(member);
const membershipFee = `${registrationConfig.membershipFee}`;
const paymentIban = registrationConfig.iban;
const accountHolder = registrationConfig.accountHolder;
const paymentIban = registrationConfig.iban || '';
const accountHolder = registrationConfig.accountHolder || '';
const portalUrl = `${process.env.NUXT_PUBLIC_DOMAIN || 'https://monacousa.org'}/dashboard`;
const currentYear = new Date().getFullYear();

View File

@ -513,3 +513,45 @@ export async function getEmailService(): Promise<EmailService> {
export function createEmailService(config: SMTPConfig): EmailService {
return new EmailService(config);
}
/**
* Generic send email function for custom templates
*/
export async function sendEmail(options: {
to: string;
subject: string;
template: string;
data: any;
}): Promise<void> {
try {
const emailService = await getEmailService();
// Get the template
const templateFunction = (emailService as any).getTemplate(options.template);
if (!templateFunction) {
throw new Error(`Email template '${options.template}' not found`);
}
// Add common template data
const templateData = {
...options.data,
logoUrl: options.data.logoUrl || 'https://portal.monacousa.org/MONACOUSA-Flags_376x376.png',
baseUrl: process.env.NUXT_PUBLIC_DOMAIN || 'https://portal.monacousa.org'
};
// Compile template with data
const html = templateFunction(templateData);
// Send email using the private sendEmail method
await (emailService as any).sendEmail({
to: options.to,
subject: options.subject,
html
});
console.log(`[sendEmail] ✅ Email sent successfully to ${options.to} using template '${options.template}'`);
} catch (error) {
console.error(`[sendEmail] ❌ Failed to send email to ${options.to}:`, error);
throw error;
}
}