Give every email a full legal footer (Anbieterkennzeichnung), not just a company line
Order confirmation, resend-verification, and the internal critical-alert mail now render name, street, ZIP/city, email, and VAT ID from company-settings instead of a bare "<sellerName> · <sellerEmail>" line, so every email this app sends meets business-correspondence footer requirements rather than just the customer-facing ones. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+21
-9
@@ -1,16 +1,25 @@
|
||||
import { transport } from "./mailer";
|
||||
import { buildLegalFooterLines, renderVerificationEmailHtml } from "./emailTemplates";
|
||||
import { getSellerForInvoice } from "./invoiceData";
|
||||
|
||||
// Fire-and-forget by design — callers should not await this in a way that
|
||||
// blocks or fails the actual error response the customer sees. Wrap
|
||||
// everything in its own try/catch so a broken mail relay never becomes a
|
||||
// second, worse failure on top of the one being reported.
|
||||
// second, worse failure on top of the one being reported. Internal-only
|
||||
// (sent to admin@mk360.de, this business's own inbox), but still carries
|
||||
// the plain-text Anbieterkennzeichnung for consistency with every other
|
||||
// email this app sends — see buildLegalFooterLines() in emailTemplates.ts.
|
||||
export function sendCriticalAlert(subject: string, details: Record<string, unknown>): void {
|
||||
transport
|
||||
.sendMail({
|
||||
from: '"einfach produktiv Alerts" <admin@mk360.de>',
|
||||
to: "admin@mk360.de",
|
||||
subject: `[einfach produktiv] ${subject}`,
|
||||
text: JSON.stringify(details, null, 2),
|
||||
getSellerForInvoice()
|
||||
.catch(() => null)
|
||||
.then((seller) => {
|
||||
const footer = buildLegalFooterLines(seller).join("\n");
|
||||
return transport.sendMail({
|
||||
from: '"einfach produktiv Alerts" <admin@mk360.de>',
|
||||
to: "admin@mk360.de",
|
||||
subject: `[einfach produktiv] ${subject}`,
|
||||
text: `${JSON.stringify(details, null, 2)}\n\n---\n${footer}`,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("sendCriticalAlert: failed to send alert email", err);
|
||||
@@ -24,13 +33,16 @@ export function sendCriticalAlert(subject: string, details: Record<string, unkno
|
||||
// route.ts), which updates the token via the customer's own session
|
||||
// (app/lib/customerAuth.ts's resendVerificationEmail) but has no Payload
|
||||
// hook to piggyback on for a plain update, so it sends directly instead —
|
||||
// same Hostinger transport as the alert above, just a different template.
|
||||
// same Hostinger transport as the alert above, and the same branded
|
||||
// emailShell()/legal-footer template as every other email (see
|
||||
// renderVerificationEmailHtml in emailTemplates.ts).
|
||||
export async function sendVerificationEmail(to: string, firstName: string, token: string): Promise<void> {
|
||||
const url = `https://einfach-produktiv.mk360.de/api/account/verify-email?token=${token}`;
|
||||
const seller = await getSellerForInvoice();
|
||||
await transport.sendMail({
|
||||
from: '"einfach produktiv" <admin@mk360.de>',
|
||||
to,
|
||||
subject: "Bitte bestätige deine E-Mail-Adresse",
|
||||
html: `<p>Hallo ${firstName},</p><p>bitte bestätige deine E-Mail-Adresse für dein Konto bei einfach produktiv:</p><p><a href="${url}">${url}</a></p><p>Der Link ist 24 Stunden gültig.</p>`,
|
||||
html: renderVerificationEmailHtml(firstName, url, seller),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user