feat(email): implement professional responsive b2b html email template
All checks were successful
Staging Build / build (push) Successful in 3m9s

This commit is contained in:
DanielS
2026-09-08 00:09:16 +02:00
parent ec11ad8498
commit e78fe7c4b8
4 changed files with 482 additions and 222 deletions

View File

@@ -8,7 +8,7 @@ import { sendMail } from '@/utils/mail';
import { renderToBuffer } from '@react-pdf/renderer';
import React from 'react';
import { InvoicePDF } from '@/components/invoice-pdf';
import { getOrderEmailTemplate, buildEmailItemsSection } from '@/lib/actions/email-templates';
import { generateOrderEmailHtml, generateOrderEmailSubject } from '@/lib/actions/email-templates';
function generateOrderNumber(prefix: 'BE' | 'AE' = 'AE'): string {
const year = new Date().getFullYear();
@@ -147,21 +147,22 @@ async function triggerPostProcessing(orderId: string, supabase: any, customerSna
`;
}
const itemsSection = buildEmailItemsSection(items);
const emailTemplate = getOrderEmailTemplate({
const emailTemplate = generateOrderEmailHtml({
orderNumber: order.order_number,
status: 'pending',
formattedDate,
customerCompanyName: customerSnapshot.company_name,
totalDetailsText,
totalDetailsHtml,
itemsDetailsText: itemsSection.text,
itemsDetailsHtml: itemsSection.html
}, `${process.env.NEXT_PUBLIC_SITE_URL || 'https://staging.hephex.de'}`, false);
items,
taxRate,
oneTimeNet,
monthlyNet,
});
const mailSubject = generateOrderEmailSubject(order.order_number, 'pending');
await sendMail({
to: email,
subject: `Anfragebestätigung ${order.order_number}`,
subject: mailSubject,
text: emailTemplate.text,
html: emailTemplate.html,
attachments: [